samantha
samantha

Reputation: 563

To run a shell script (with parameters) on Windows command line via putty.exe

I need to execute a batch script which runs the shell script remotely inside the Linux box.

Now, everything is working fine, but the script fails to execute if I try to give a command line parameter to the shell script.

Working -> ex

C:\temp\Testing>putty.exe -pw "blabla" -m "test-script.sh" bob@10.20.110.57

But if I try to give arguments it fails to execute. Example:

Not Working

C:\temp\Testing>putty.exe -pw "blabla" -m "test-script.sh ok-1" bob@10.20.110.57

 where ok-1 = command line argument for local script test-script.sh

How can I fix this problem?

Upvotes: 4

Views: 18915

Answers (1)

bta
bta

Reputation: 45087

Instead of using putty.exe, you can use pscp and plink (utilities that come with PuTTY) to do this. Use a command like this:

pscp.exe -pw "blabla" test-script.sh bob@10.20.110.57:/some/path/

to copy the script to the remote server, and then use a command like this:

plink.exe -ssh -pw "blabla" bob@10.20.110.57 /some/path/test-script.sh ok-1

to execute it.

Upvotes: 6

Related Questions