5

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

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

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 文件是通过 VS 2012 Ultimate 在 Windows 8 上创建的。

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

4

1 回答 1

8

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

使用编码保存

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

于 2013-04-08T10:50:23.100 回答