“试图在Ubuntu的PowerShell Core中执行内联命令时,术语'-Command'未被识别为cmdlet的名称

问题描述 投票:0回答:1

我正在尝试在Ubuntu的PowerShell Core(6.2.3)中执行内联命令。

这将引发错误:

pwsh -Command "Write-Host 'Hello, world'"

-Command:术语“ -Command”未被识别为cmdlet,函数,脚本文件或可运行程序的名称。

如果有帮助,我将PowerShell安装为dotnet核心全局工具。

.net-core ubuntu-18.04 powershell-core
1个回答
0
投票

传递不带参数名称的命令:

pwsh "Write-Host 'Hello, world'"

[Microsoft's documentation shows that the parameter name is required,所以这可能是安装pwsh作为dotnet核心工具的怪癖。

© www.soinside.com 2019 - 2024. All rights reserved.