Plink batch file - Problem sending commands

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have successfully created a batch file to connect to a remote Unix
computer using Plink from a windows PC.
Once connected I want the batch file to send some commands to the
remote computer to change the directory and to start analysis on a
certain file.

The batch file I am using is as follows:
     cd C:\Plink
     plink -pw mypassword


This connects fine, and I can then type my commands by hand into the
CMD window ...

     cd dirname ... change the Dir
     abq641 job=jobname input=jobname... run the analysis

all works fine. However I am trying to get the batch file to execute
these commands for me, but I cannot get it to work. I have tried the

     cd C:\Plink
     plink -pw mypassword
     cd scratch
     abq641 job=jobname input=jobname

but this does not execute the commands, it logs in fine and then stop
after the second line.

I have also tried
     cd C:\Plink
     plink -pw mypassword  -batch cd scratch
     abq641 job=jobname input=jobname

but this does not even log in... it just closes the CMD window.

All works fine if I type the command in by hand, but I cannot get the
batch file to do it for me!! Please can any one offer me any help or
advice in this matter.



Re: Plink batch file - Problem sending commands

Quoted text here. Click to load it

Of course.  The computer is not going to magically do what you want just
because you arrange the commands so they appear on the screen in a
suggestive order. :) You want plink to execute those commands on the
remote host, but you have done nothing to arrange that; you have put them
in the local batch file instead.  They will be executed on the local
computer, after plink exits (having done nothing), just like any other
command you put in that file.

Place the commands you want run on the remote host in a separate file, and run "plink -batch ...".

  Richard Silverman

Site Timeline