tags:

views:

207

answers:

2

Hi,

I am trying to use Plink for running commands on remote server. Both, local & remote machine are Windows. Though I am able to connect to the remote machine using Plink, i am not able to use the '-m file' option.

I tried the following three ways but to no avail:


Try 1: plink.exe -ssh -pw mypwd gchhabra@machine -m file.txt

Could not chdir to home directory /home/gchhabra: No such file or directory dir: not found

  • file.txt only contains one command i.e., dir

Try 2: plink.exe -ssh -pw mypwd gchhabra@machine dir

Could not chdir to home directory /home/gchhabra: No such file or directory dir: not found


Try 3: plink.exe -ssh -pw mypwd gchhabra@machine < file.txt

In this case, I get the following output:

Using username "gchhabra".

                        ****USAGE WARNING****

This is a private computer system. This computer system, including all ..... including personal information, placed or sent over this system may be monitored.

Use of this computer system, authorized or unauthorized, constitutes consent ... constitutes consent to monitoring for these purposes.

dirCould not chdir to home directory /home/gchhabra: No such file or directory Microsoft Windows [Version x.x.xxx] (C) Copyright 1985-2003 Microsoft Corp.

C:\Program Files\OpenSSH>

After I get the above prompt, it hangs.


Can anyone please help me with this?

Regards,

Gaurav

A: 

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

Technext
A: 

This is working now.

plink -ssh -pw xxx gaurav.chhabra@server cmd.exe /c move c://sample//gc//file.txt c://test//

Technext