Reputation: 2290
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?
Upvotes: 2
Views: 3637
Reputation: 44181
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"
Upvotes: 5