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?
PowerShell is now an open source project, and it can be installed on Windows, macOS, and Linux platforms. This shell is based on the .NET framework, and it includes a command-line shell and a scripting language. The first version of PowerShell was released in November 2006 for Windows XP, Windows Server 2003 and Windows Vista.
What exactly does the & symbol do/mean in powershell? & is the call operator which allows you to execute a command, a script, or a function. For more details: &
PowerShell is a much more powerful tool than the Command Prompt. It is also intended to replace the Command Prompt, as it delivers more power and control over the Windows operating system.
The word that precedes the hyphen in a PowerShell cmdlet name. The verb describes the action that the cmdlet performs. The Integrated Scripting Environment - A Windows PowerShell host application that enables you to run commands and to write, test, and debug scripts in a friendly, syntax-colored, Unicode-compliant environment.
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 from standard input.
< is just the stdout -> stdin redirection operator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With