Error working with PowerShell commands on Azure WorkerRole

I am trying to run the cmd-script startup task in the role of Windows Azure.

These are the two lines of the script command file:

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

Now the problem is that I get an error message from the shell saying:

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

It seems like some kind of different code pages are used or something related to this because these special characters are not in my cmd file. The cmd file was created in Windows 8 through VS 2012 Ultimate.

Do you have an idea how I can fire special characters at the beginning of a command there? If I copy the command from the cmd file to the console through the remote desktop, it works fine!

+5
source share
1 answer

Open whatever.cmd file with VS 2012 Ultimate. Click FileSave whatever.cmd as → in the dialog box next to the [save] button, an arrow will appear next to it. A menu will appear Save with Encoding option:

Save With Encoding

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

+8
source

All Articles