gpt4 book ai didi

azure-cloud-shell - Azure Cloud Shell 运行 ps1 脚本时出现问题

转载 作者:行者123 更新时间:2023-12-04 17:06:47 26 4
gpt4 key购买 nike

在我们的 Azure Cloud 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 .
诀窍是在保存脚本的位置打开外壳。
这仅在您的脚本不使用存储在本地设备上的库时才有效。您可能还需要导入所需的任何模块,例如蔚蓝AD

# change to your cloud drive fileshare
cd $HOME\clouddrive

# run the script
.\helloworld.ps1

Hello World!

关于azure-cloud-shell - Azure Cloud Shell 运行 ps1 脚本时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52229808/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com