【发布时间】:2020-01-17 18:13:13
【问题描述】:
根据pwsh documentation,我应该能够传递命令行参数,例如 -Command 或 -NoExit,但这些参数无法识别:
> pwsh -NoExit
-NoExit : The term '-NoExit' is not recognized as the name of a cmdlet, function, script file, or operable program.
...
> pwsh -NoLogo
-NoLogo : The term '-NoLogo' is not recognized as the name of a cmdlet, function, script file, or operable program.
...
> pwsh -h
-h : The term '-h' is not recognized as the name of a cmdlet, function, script file, or operable program.
...
> pwsh -Command "Write-host hello"
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or operable program.
...
但这有效:
> pwsh "Write-host hello"
hello
这是怎么回事???
【问题讨论】:
-
你用的是什么外壳?
-h、-help和-?都为我打开了pwsh帮助文本。 -
此行为在 Windows cmd 提示符和 Powershell 提示符下都发生
标签: powershell-core