更新时间:2023-10-27 21:41:34
我会完全摆脱函数调用.您根本不会丢失命名参数和 cmdlet 包装.所以这个:
I would get rid of the function call altogether. You don't lose named parameters and cmdlet wrapping at all. So this:
function Hello
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$Message
)
Write-Host "Hello, $Message!"
}
变成:
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$Message
)
Write-Host "Hello, $Message!"
你可以这样:
> .hello.ps1 "World"