[英]Powershell can't access runtime environment variables
I want to create a task which calls a Powershell script to do some processing.我想创建一个调用 Powershell 脚本来进行一些处理的任务。 However I can't access Azure Batch runtime environment variables from my Powershell script.
但是我无法从我的 Powershell 脚本中访问 Azure 批处理运行时环境变量。
I can access via cmd, command below correctly outputs我可以通过 cmd 访问,下面的命令正确输出
D:\batch\tasks\applications\test12020-05-04-17-32':
D:\batch\tasks\applications\test12020-05-04-17-32':
cmd /c echo %AZ_BATCH_APP_PACKAGE_Test#1%
However equivalent Powershell command below shows incorrect output但是下面的等效 Powershell 命令显示不正确的 output
%AZ_BATCH_APP_PACKAGE_Test#1%':
%AZ_BATCH_APP_PACKAGE_Test#1%':
powershell -Command echo %AZ_BATCH_APP_PACKAGE_Test#1%
Of course there is a hacky way around this which is to create a.bat script to call my.ps1 script.当然,有一种解决方法是创建一个 .bat 脚本来调用 my.ps1 脚本。 But I was looking for a better solution.
但我一直在寻找更好的解决方案。
Is it possible to access Azure Batch runtime environment variables from Powershell?是否可以从 Powershell 访问 Azure 批处理运行时环境变量?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.