The recommended way to run scripts is
powershell.exe -NonInteractive -Command " & some.ps1 "
However for example TeamCity PowerShell runner uses:
powershell.exe -NonInteractive -Command - < some.ps1
I do not have an idea what “- <” means and cannot find any information on subject. Any help?
Because
powershell.exeis being invoked through the Windows shell, it is the same as if you were on a normal command prompt (cmd.exe). In that situation<pipes a file to the standard input (stdin) of the previous command. The help forpowershell.exestates that if the value of-Commandis simply-, the command text is read from standard input.Here’s a more self-documenting demonstration of
<incmd.exe: