locked
Running commands on remote box using Plink RRS feed

  • Question

  • Hi,

     

    I am using Plink to access remote server. Both machines are WindowsXP (XP Professional & 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
    Tuesday, May 25, 2010 11:51 AM

All replies

  • 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//

     

    plink -ssh -pw xxx gaurav.chhabra@server –m file.txt

     

    where ‘file.txt’ contains:

    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://test//

     

    move: not found

    ---------------------------------------------------------------------------------------------

     

    Any idea what the problem might be?

     

     

    Thanks,

    GC
    Wednesday, June 30, 2010 5:46 AM