powershell -ExecutionPolicy Bypass -File script.ps1
powershell -ExecutionPolicy Bypass -Command "your script here"
CMD>
C:> powershell -File "C:abbixhello.ps1"
PS>
cd "C:abbix";
echo 'Write-host "Please enter your name:"' > hello.ps1
echo '$userName = read-host' >> hello.ps1
echo '"Hello $userName!"' >> hello.ps1
type hello.ps1
./hello.ps1
For Error: cannot be loaded because the execution of scripts is disabled on this system, Use:
PS> set-executionpolicy remotesigned
powershell -Command "& echo test"