カスタム関数を定義する.ps1ファイルがあります。
ファイルの名前がMyFunctions.ps1で、内容は次のとおりだとします。
Write-Host "Installing functions"
function A1
{
    Write-Host "A1 is running!"
}
Write-Host "Done"
このスクリプトを実行して理論的にはA1関数を登録するには、.ps1ファイルが存在するフォルダーに移動してファイルを実行します。
.\MyFunctions.ps1これは出力します:
Installing functions
Done
それでも、A1を呼び出そうとすると、その名前のコマンド/関数がないというエラーが表示されます。
The term 'A1' 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 line:1 char:3
+ A1 <<<<
    + CategoryInfo          : ObjectNotFound: (A1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
PowerShellのいくつかの概念を誤解する必要があります。スクリプトファイルで関数を定義できませんか?
実行ポリシーをすでに「RemoteSigned」に設定していることに注意してください。そして、ファイル名の前にドットを使用して.ps1ファイルを実行することを知っています:。\ myFile.ps1