A way of typing multiple commands in cmd.txt file using PuTTY batch against Cisco

前端 未结 1 1706
無奈伤痛
無奈伤痛 2020-12-20 05:31

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:\\Users\\emrpocadmin\\desktop         


        
相关标签:
1条回答
  • 2020-12-20 05:55

    It's actually a known limitation of Cisco, that it does not support multiple commands in an SSH "exec" channel command.

    Quoting section 3.8.3.6 -m: read a remote command or script from a file of PuTTY/Plink manual:

    With some servers (particularly Unix systems), you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers. In particular, it is known not to work with certain ‘embedded’ servers, such as Cisco routers.


    Using Plink (PuTTY command-line connection tool) with an input redirection may solve the problem (you should not use PuTTY to automate command execution anyway).

    plink.exe -ssh IPAddress -l User -pw Password -load Site%%n% < cmds.txt
    
    0 讨论(0)
提交回复
热议问题