错误运行PowerShell命令在Azure上WorkerRole [英] Error running PowerShell Commands On Azure WorkerRole

查看:127
本文介绍了错误运行PowerShell命令在Azure上WorkerRole的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行在Windows Azure角色启动任务CMD脚本。

I am trying to run a startup task cmd-script on a Windows Azure Role.

这是命令文件脚本的两行:

This are the two lines of the command file script:

powershell $command = "set-executionpolicy Unrestricted"    
powershell $command = ".\setupAgent.ps1" -NonInteractive >; out.txt

现在的问题是,我得到的命令shell错误消息,上面写着:

Now the problem is, I get an error message from the command shell, that says:

D:\Users\UserAccount>powershell $command = "set-executionpolicy Unrestricted"
'powershell' is not recognized as an internal or external command,
operable program or batch file.

它看起来像有使用某种不同的codepages什么临客的,因为这些特殊字符是不是在我的CMD文件。在CMD文件是通过VS 2012旗舰版在Windows 8上创建的。

It looks like there are used some kind of different codepages or something linke that, because these special chars are not in my cmd file. The cmd-file was created on Windows 8 via VS 2012 Ultimate.

你有一个想法,我怎么可以在命令开头解雇有特殊字符?如果我从CMD文件复制命令通过远程桌面控制台正常工作!

Do you have an idea, how I can dismiss there special chars at the beginning of the command? If I copy the command from the cmd-file to the console via remote desktop it works fine!

推荐答案

打开你的VS 2012终极你的 whatever.cmd 文件。点击文件 - > 另存为whatever.cmd - >在对话框上有旁边的<$小箭头C $ C> [保存] 按钮。这将显示,将有选项菜单带编码保存

Open your whatever.cmd file with your VS 2012 Ultimate. Click on File->Save whatever.cmd as -> on the dialog there is little arrow next to the [save] button. It will show up a menu that will have the option Save with Encoding:

选择它。现在选择US-ASCII codePAGE 20127从可用编码的列表。

Select it. Now choose "US-ASCII Codepage 20127" from the list of available encodings.

这篇关于错误运行PowerShell命令在Azure上WorkerRole的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆