パラメータを取り込んで関数を使用するPowerShellスクリプトを作成したいと思います。
私はこれを試しました:
param
(
$arg
)
Func $arg;
function Func($arg)
{
Write-Output $arg;
}
しかし、私はこれを手に入れました:
The term 'Func' is not recognized as the name
of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At func.ps1:6 char:5
+ Func <<<< $arg;
+ CategoryInfo : ObjectNotFound: (Func:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
いいと思いました。代わりにこれを試してみます:
function Func($arg)
{
Write-Output $arg;
}
param
(
$arg
)
Func $arg;
しかし、その後、私はこれを手に入れました:
The term 'param' is not recognized as the name
of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At C:\Users\akina\Documents\Work\ADDC\func.ps1:7 char:10
+ param <<<<
+ CategoryInfo : ObjectNotFound: (param:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
私が求めているのは実行可能ですか?それとも私は私の要求に無理がありますか?