1
votes

MY SERVER: BitVise SSH server for windows

My Client: plink.exe

I cannot for the life of me figure out how to change a directory when using plink.exe and execute a script in that directory.

I am doing something like this to try and send a command to switch a directory and execute a script:

C:\plink.exe -ssh 10.10.10.10 -P 22 -l user -pw password cd C:\sample && install.bat

However, my command fails each time I run this, stating that install.bat does not exist. If I use putty, connect with the GUI, and run the cd C:\sample && install.bat command, everything works as expected.

Is it possible to tell plink what directory to connect to?

1
Since & is a command separator in cmd, did you put your command in quotes? I would bet that it is trying to run cd C:\sample on the server and install.bat locally. - Dark Falcon
@DarkFalcon ah you are right. post it as the answer so I can mark it as done. TY! I hate windows ;) - angryip

1 Answers

4
votes

Since & is a command separator in cmd, did you put your command in quotes? I would bet that it is trying to run cd C:\sample on the server and install.bat locally.

C:\plink.exe -ssh 10.10.10.10 -P 22 -l user -pw password "cd C:\sample && install.bat"