"The term '-Command' is not recognized as the name of a cmdlet" 在 Ubuntu 上尝试在 PowerShell Core 中执行内联命令时
"The term '-Command' is not recognized as the name of a cmdlet" when trying to execute an inline command in PowerShell Core on Ubuntu
我正在尝试在 Ubuntu 上执行 PowerShell Core (6.2.3) 中的内联命令。
这会引发错误:
pwsh -Command "Write-Host 'Hello, world'"
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or operable program.
我将 PowerShell 安装为 dotnet 核心全局工具,如果这有影响的话。
传递不带参数名称的命令:
pwsh "Write-Host 'Hello, world'"
Microsoft's documentation shows that the parameter name is required,所以这可能是安装 pwsh
作为 dotnet 核心工具的一个怪癖。
我正在尝试在 Ubuntu 上执行 PowerShell Core (6.2.3) 中的内联命令。
这会引发错误:
pwsh -Command "Write-Host 'Hello, world'"
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or operable program.
我将 PowerShell 安装为 dotnet 核心全局工具,如果这有影响的话。
传递不带参数名称的命令:
pwsh "Write-Host 'Hello, world'"
Microsoft's documentation shows that the parameter name is required,所以这可能是安装 pwsh
作为 dotnet 核心工具的一个怪癖。