Save PuTTY ouput to file from command-line

后端 未结 4 1708
北海茫月
北海茫月 2020-12-31 08:52

Is there any way to save the PuTTY output to a file using the command line? I know this is easily done using the GUI but in my case it has to be done automatically.

4条回答
  •  感动是毒
    2020-12-31 09:41

    Expanding on Dave's and Charlie's answers...

    Apart from making sure plink is in the path, also check whether you have write access to local ouput file.

    This is how you redirect command output from remote machine to local file with plink. In this example we store an output from man page for nfcapd:

    plink joe@192.168.50.50 -pw joespassword man nfcapd > output.log 2>&1
    

    The first time you try to access the server, it will ask you store key in cache. So make sure to access the machine at least once before:

    plink joe@192.168.50.50 -pw joespassword
    
    The server's host key is not cached in the registry. You 
    have no guarantee that the server is the computer you
    think it is.
    ...
    Store key in cache? (y/n)
    

提交回复
热议问题