私はWindows 7 RTMを実行しています。 Powershell 2.0はデフォルトでインストールされます。私は優れたWindows Powershell ISEを使用してスクリプトを編集しています。私は次のスクリプトを持っています:Powershell 2.0 Paramキーワードエラー
Param($p)
Param($d)
echo $p $d
私はSayItAgain.ps1としてスクリプトを保存します。私はそうのような対話型のシェルからこのスクリプトを実行しようとすると:
./SayItAgain -p "Hello"
私は次のエラーを受け取る:
The term 'Param' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling o
f the name, or if a path was included, verify that the path is correct and try again.
At C:\users\cius\Code\powershell\SayItAgain.ps1:2 char:6
+ Param <<<< ($destination)
+ CategoryInfo : ObjectNotFound: (Param:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
これは既知の問題ですか、私は単にそれが間違って使用していますか?
をコメントしたとき、私は同じエラーに
を得ました実際のエラーはスクリプトの別の行にあります。あなたは./SayItAgain.ps1を呼び出していると言いますが、エラーはFindAndCopyFiles.ps1を呼び出していると言います。共有できるコードはもうありますか?エラーが間違った方向に向かうことがあります。エラーは別の場所にある可能性があります。 –
ああ、私は矛盾をお詫び申し上げます。私は問題を追跡する簡単な例としてSayItAgainを作成しました。元のスクリプトのエラーを間違ってコピーしました。これを私の補遺で説明します。 –