简体   繁体   中英

Best way to run batch file in network drive in Windows Sever through SSH

I am currently using SSH to connect to a Window Server with freeSSHd to run batch files.

If the batch file is in C drive, then using my command works:

C:\cygwin64\bin\ssh.exe -o 'StrictHostKeyChecking no' server -l name 'C:\test.bat'

However, if my batch file is in a non-C drive, then it would say: The system cannot find the drive specified. For example:

C:\cygwin64\bin\ssh.exe -o 'StrictHostKeyChecking no' server -l name 'W:\test.bat'

How would I run a batch file in network drive through SSH then?

Also what is the way to check if W:\test.bat file exist?

You should first change the current directory with this command

w:

then you should be able to run the script. Anyway, a few months ago I was running in the same issue and ended up making a super simple PHP local only script to run my bat. I think is the best way if you already have a PHP server on it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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