這裏是我的代碼:PowerShell中傳遞命令行參數
$script={
Write-Host "Num Args:" $args.Length;
Write-Host $args[0]
}
Invoke-Command -ScriptBlock $script
當我運行
powershell.exe .\test.ps1 one two three
我
Num Args: 0
我想我會得到
Num Args: 3
One
我錯過了什麼?
感謝