在Azure辅助角色上运行PowerShell命令时出错

时间:2013-04-08 09:02:08

标签: powershell azure

我正在尝试在Windows Azure角色上运行启动任务cmd脚本。

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

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

现在问题是,我从命令shell收到一条错误消息:

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

看起来有些使用某种不同的代码页或某些内容,因为这些特殊的字符不在我的cmd文件中。 cmd文件是在Windows 8上通过VS 2012 Ultimate创建的。

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

1 个答案:

答案 0 :(得分:8)

使用VS 2012 Ultimate打开您的whatever.cmd文件。点击File - > Save whatever.cmd as - >在对话框中,[save]按钮旁边有一个小箭头。它会显示一个菜单,其中包含选项Save with Encoding

Save With Encoding

选择它。现在从可用编码列表中选择“US-ASCII Codepage 20127”。

相关问题