Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux server with winexe package installed. It's the same as PSExec, and everything works okay when running simple commands, but when I run it with this command below I get a parsing error!

winexe -U user%password //host "powershell -Command (New-Object System.Net.WebClient).DownloadFile("http://host/filename.iso","c:\file.iso")"

Can anyone figure what's wrong with this? Is it's cause a conflict in the quotes around the url and file name, with the quotes around the whole command?

share|improve this question
Can you post the full error message? – cpast Mar 18 '13 at 22:07
up vote 3 down vote accepted

Try using the format: powershell.exe -Command "& {<command>}"

This worked for me, using your example:

powershell.exe -Command "& {(New-Object System.Net.WebClient).DownloadFile('','c:\robots.txt')}"

Also, I used single-quotes in DownloadFile


share|improve this answer

Nested use of double quotes won't work. Try something like this:

winexe -U user%password //host "powershell -Command (New-Object System.Net.WebClient).DownloadFile('http://host/filename.iso','c:\file.iso')"
share|improve this answer

The easiest way is to run the command directly using single quote. For example listing the processes can be done as follows:

winexe -U "Domain\PC-Name" //IP Address 'powershell.exe Get-Process'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.