Running commands on remote box using Plink

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Technext
Posts: 13
Joined: 24 May 2010 07:42

Running commands on remote box using Plink

#1 Post by Technext » 24 May 2010 11:17

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

Technext
Posts: 13
Joined: 24 May 2010 07:42

Re: Running commands on remote box using Plink

#2 Post by Technext » 29 Jun 2010 23:54

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

Post Reply