Azure Cloud Shell 麻烦 运行 ps1 脚本
Azure Cloud Shell Trouble running ps1 Scripts
在我们的 Azure 云 Shell 中,Powershell 模式我们无法 运行 ps1 文件。尽管我们正在做与 MS Doc 相同的事情。
任何建议,我做错了什么。
PS Azure:\> dir
Directory: Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
Mode Name
---- ----
. Build_goal.ps1
. Test goal_Files.ps1
. test.ps1
Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
PS Azure:\> ./test.ps1
./test.ps1 : The term './test.ps1' 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:1
+ ./test.ps1
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./test.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
PS Azure:\>
下面的例子来自Microsoft Docs。
诀窍是 shell 在脚本保存的位置打开。
这仅在您的脚本不使用存储在本地设备上的库时才有效。您可能还需要导入所需的任何模块,例如AzureAD
# change to your cloud drive fileshare
cd $HOME\clouddrive
# run the script
.\helloworld.ps1
Hello World!
Cloud Shell 的默认目录似乎不允许脚本 运行ning。将脚本复制到“$HOME\clouddrive”,更改到那个目录,然后从那里 运行 它。
在我们的 Azure 云 Shell 中,Powershell 模式我们无法 运行 ps1 文件。尽管我们正在做与 MS Doc 相同的事情。 任何建议,我做错了什么。
PS Azure:\> dir
Directory: Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
Mode Name
---- ----
. Build_goal.ps1
. Test goal_Files.ps1
. test.ps1
Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
PS Azure:\> ./test.ps1
./test.ps1 : The term './test.ps1' 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:1
+ ./test.ps1
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./test.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
PS Azure:\>
下面的例子来自Microsoft Docs。 诀窍是 shell 在脚本保存的位置打开。 这仅在您的脚本不使用存储在本地设备上的库时才有效。您可能还需要导入所需的任何模块,例如AzureAD
# change to your cloud drive fileshare
cd $HOME\clouddrive
# run the script
.\helloworld.ps1
Hello World!
Cloud Shell 的默认目录似乎不允许脚本 运行ning。将脚本复制到“$HOME\clouddrive”,更改到那个目录,然后从那里 运行 它。