且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PowerShell 参数 - "术语 'param'不被识别为 cmdlet 的名称"

更新时间:2022-04-16 03:52:59

如果您的脚本需要参数,Param 关键字必须是脚本中的第一条语句.

If your script requires arguments, the Param keyword must be the first statement in the script.

但是,您可以稍后使用 Read-Host cmdlet 要求用户输入:

However, you can ask the user for input later by using the Read-Host cmdlet:

$processId = Read-Host "Enter the PID of the process to kill"