简体   繁体   English

Plink工作目录

[英]Plink working directory

MY SERVER: BitVise SSH server for windows 我的服务器:用于Windows的BitVise SSH服务器

My Client: plink.exe 我的客户端: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. 我不能为我的生活弄清楚如何在使用plink.exe并在该目录中执行脚本时更改目录。

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. 但是,每次运行此命令时,我的命令都会失败,说明install.bat不存在。 If I use putty, connect with the GUI, and run the cd C:\\sample && install.bat command, everything works as expected. 如果我使用putty,连接GUI,并运行cd C:\\ sample && install.bat命令,一切都按预期工作。

Is it possible to tell plink what directory to connect to? 有可能告诉plink要连接的目录是什么?

Since & is a command separator in cmd , did you put your command in quotes? 由于&cmd的命令分隔符,您是否将命令放在引号中? I would bet that it is trying to run cd C:\\sample on the server and install.bat locally. 我敢打赌,它试图在服务器上运行cd C:\\sample ,在本地运行install.bat

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM