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'm trying to run a simple bat file from windows that will run a bash script on linux machine. The bash script is located on the linux machine.

For example: I'm trying to run this bat file from windows

plink.exe -pw <password> root@<ip> bash -c "/root/"


  • When running from windows the cmd is stuck forever
  • when running the specific script (/root/ from the linux machine it's working just fine.
  • The script contain ruby code and I'm using RVM
share|improve this question
Does the script require any interaction? What happens if you run bash -c "/root/ &" instead? – Daniel Andersson Apr 18 '12 at 11:02

what do you see if you run the following? this will step through the script.

plink.exe -pw <password> root@<ip> bash -x "/root/"

also, be aware that the environment set up is different when you run remotely. you must make sure that all that is set up properly, such as PATH. so your script must say either /usr/bin/ruby instead of ruby, or add /usr/bin in the PATH, etc.

Or source a file that will set them up.

share|improve this answer
I'm getting the following error: "/bin/sh: cannot execute binary file – user128877 Apr 19 '12 at 6:36
ok, then change bash to /bin/bash, or /bin/sh and try again. – johnshen64 Apr 19 '12 at 12:10
How should I write on windows? I'm running this from windows machine to linux machine – user128877 Apr 19 '12 at 12:33
plink.exe -pw <password> root@<ip> /bin/bash -x "/root/" – johnshen64 Apr 19 '12 at 12:43
plink.exe -pw <password> root@<ip> /bin/sh -x "/root/" – johnshen64 Apr 19 '12 at 12:43

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.