I am very new to batch scripting and have the following in a batch file:
echo off
setlocal
SET cluster="cluster"
(
cd "C:\path"
python script.py -nodes %cluster% -type worker -index 1 -batch 64 > log.log 2>&1
) | plink.exe -ssh user@host -pw password
cd "C:\path2"
python worker.py -nodes %cluster% -type worker -index 0 -batch 64 > log.log 2>&1
pause
However, something's up with:
(
cd "C:\path"
python script.py -nodes %cluster% -type worker -index 1 -batch 64 > log.log 2>&1
) | plink.exe -ssh user@host -pw password
It does not seem like the python file runs on the remote server (or if it is, the log file is not saving). In addition, plink.exe gives me some weird output-- the below is what I see:
Using username "user".
[2J[?25l[m[H
[H]0;c:\windows\system32\cmd.exe[?25h[?25lMicrosoft Windows [Version 10.0.18363.1377][9X[9C
(c) 2019 Microsoft Corporation. All rights reserved.
[52X[52C
user@host C:\Users\user>[10X[10C[4;43H]0;Administrator: c:\windows\system32\cmd.exe[?25h
^
I also get the above output if I were to plink.exe -ssh user@host -pw password
on cmd.exe.
However, I am more interested in understanding why the commands
cd "C:\path"
python script.py -nodes %cluster% -type worker -index 1 -batch 64 > log.log 2>&1
do not seem to be executed on the server.
The commands
cd "C:\path2"
python worker.py -nodes %cluster% -type worker -index 0 -batch 64 > log.log 2>&1
seem to work fine as I see a log file being saved. It is the commands when sshing that do not.