Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i have two machines:
1) windows xp prof., where i have a Exec.bat which takes one parameter
2) debian machine, where i have a Run.sh which also takes one parameter

Now, currently i am switching between machines and doing the following:
Run.sh 1
Exec.bat 1
Run.sh 2
Exec.bat 2
...

My question is how is it possible to run the Run.sh which takes one argument from inside the Exec.bat, or otherway would also be good as a solution. thanks!

share|improve this question
    
Search this site for putty/plink and winexe. There are examples for both tools which should allow you to go either way. –  Zoredache Jul 7 '10 at 16:11

2 Answers 2

Install an ssh server on one machine and a client on the other machine. It's easier to set up the server on Linux (just install the ssh server package) and the client on Windows (you can install putty, or a port of unix utilities such as Cygwin). Set up public key authentication so you can log in through ssh without having to type a password each time (the putty manual, or any of a zillion tutorials on the web, explain how).

Then run your commands from a batch file as follows:

ssh linux.example.com run.sh 1
call exec.bat 1
...

Another possibility is Winexe.

share|improve this answer

Take a look at Plink, from the makers of PuTTY. It is used for automated operations such as running commands through scripts like this. I use it frequently to write scripts, it is very straightforward:

C:\>plink
PuTTY Link: command-line connection utility
Release 0.58
Usage: plink [options] [user@]host [command]
       ("host" can also be a PuTTY saved session name)
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -ssh -telnet -rlogin -raw
            force use of a particular protocol
  -P port   connect to specified port
  -l user   connect with specified username
  -batch    disable all interactive prompts
The following options only apply to SSH connections:
  -pw passw login with specified password
  -D [listen-IP:]listen-port
            Dynamic SOCKS-based port forwarding
  -L [listen-IP:]listen-port:host:port
            Forward local port to remote address
  -R [listen-IP:]listen-port:host:port
            Forward remote port to local address
  -X -x     enable / disable X11 forwarding
  -A -a     enable / disable agent forwarding
  -t -T     enable / disable pty allocation
  -1 -2     force use of particular protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for authentication
  -m file   read remote command(s) from file
  -s        remote command is an SSH subsystem (SSH-2 only)
  -N        don't start a shell/command (SSH-2 only)
share|improve this answer

Your Answer

 
discard

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