I am running batch file in Windows environment using PuTTY.exe command below:
for /L %%n in (1,1,5) do (
SET z=Site%%n%
start c:Usersemrpocadmindesktopputty.exe -ssh IPAddress -l User -pw Password -m c:Usersemrpocadmindesktopcmds.txt -load Site%%n%
)
This batch should load variable profiles (n
from 1 to 5) predefined in PuTTY and run on them one-by-one the commands defined in cmds.txt
file; then save the output to certain folder..
However, in cmds.txt
file i could only enter one command!
How can I enter multiple commands on this txt file and it should be passed to the session one by one and then save the whole output results into the output file?
I tried to enter the commands on cmds.txt
file as of below formats but does not work:
show run (work as one command only)
show run; show version (does not work)
"show run; show version" (does not work)
echo show run
echo show version (does not work)
The expected result is to enter two or more commands in cmds.txt
file and it should be passed to the session one by one and then save the whole output results into the output file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…