What does "- <" mean when you run powershell?
Because powershell.exe
is 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 for powershell.exe
states that if the value of -Command
is simply -
, the command text is read from standard input.
Here's a more self-documenting demonstration of <
in cmd.exe
:
processSomeFile.exe outputFileName.ext < intputFile.ext
If the value of Command is "-", the command text is read fromstandard input.
< is just the stdout -> stdin redirection operator
I'd say that the recommaneded way to execute a script is with the -File parameter:
powershell.exe -NonInteractive -Command -File some.ps1
With regard to your question, the '<' character is reserved and cannot be used in PowerShell.