Page 1 of 1

Running commands on remote box using Plink

Posted: 24 May 2010 11:17
by Technext
Hi,


I am using Plink to access remote server. I want to run few commands on the remote server. Though I am able to connect to the remote machine, I am not able to run any command.


The following works:
--------------------------------------------------------
plink -ssh -l %user_name% -pw %user_pwd% %machine%
--------------------------------------------------------


The following doesn't:
-----------------------------------------------------------------------
plink -ssh -l %user_name% -pw %user_pwd% %machine% "cd e:\data"
-----------------------------------------------------------------------

Can anyone please tell me how to do 'cd' on a remote box using plink? Obviously, I want to run few other commands as well after doing 'cd' operation.


Regards,
GC

Re: Running commands on remote box using Plink

Posted: 29 Jun 2010 23:54
by Technext
Hi,


I have finally been able to run command on remote machine using Plink. :) The problem was with the syntax. It now works both by passing the command as argument, and by using the ‘–m file’ option provided with Plink.

For example,
plink -ssh -pw xxx gaurav.chhabra@server cd c://sample//gc

I am able to run executables and commands such as cd, mkdir. The only issue that I am now having is that, I am not able to run commands such as move, rename etc.

For example,
----------------------------------------------------------------------------
plink -ssh -pw xxx gaurav.chhabra@server move c://sample//gc//file.txt c://

move: not found
----------------------------------------------------------------------------

Any idea what the problem might be?


Thanks,
GC