我正在尝试在Ubuntu的PowerShell Core(6.2.3)中执行内联命令。
这将引发错误:
pwsh -Command "Write-Host 'Hello, world'"
-Command:术语“ -Command”未被识别为cmdlet,函数,脚本文件或可运行程序的名称。
如果有帮助,我将PowerShell安装为dotnet核心全局工具。
传递不带参数名称的命令:
pwsh "Write-Host 'Hello, world'"
[Microsoft's documentation shows that the parameter name is required,所以这可能是安装pwsh
作为dotnet核心工具的怪癖。