{"id":12761,"date":"2021-12-10T05:48:25","date_gmt":"2021-12-10T05:48:25","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=12761"},"modified":"2021-12-10T05:49:12","modified_gmt":"2021-12-10T05:49:12","slug":"plink-with-command-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/plink-with-command-file\/28082.html","title":{"rendered":"Plink With Command File"},"content":{"rendered":"<p>I use plink to retrive CISCO device information with SSH, it work very well for single command, but I couldn&#8217;t get device information if I use a command file, I use plink to connect to a device, run some commands, send the output to a text file on my local system, and exit.<\/p>\n<p>Here is my command line:<br \/>\nplink.exe -ssh myuserid@xxx.xxx.xxx.xxx -pw mypassword -m C:\\tmp\\commands.txt &gt; C:\\tmp\\Output.txt<\/p>\n<p>Here is command file &#8211; commands.txt file<br \/>\nterm length 0<br \/>\nsh ip int br<br \/>\nsh int status<br \/>\nexit<\/p>\n<p>Here is the result in Output.txt file<br \/>\nLine has invalid autocommand &#8220;term length 0<br \/>\nsh ip int br<br \/>\nsh int status<br \/>\nexit<\/p>\n<p>I modified the command line to use a comamnd string to instead of command file as following:<br \/>\nplink.exe -ssh myuserid@xxx.xxx.xxx.xxx -pw mypassword &#8220;term length 0 ; sh ip int br ; sh int status ; exit&#8221; &gt; C:\\tmp\\Output.txt<\/p>\n<p>I can run the command without any error, but I only can retrive the information for the first command in command string, it means I only can retrive device information for &#8216;term length 0&#8217;<\/p>\n<p>please give me some advice, your help will be appreciated. Thanks<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":5},"question-category":[55],"question_tags":[],"class_list":["post-12761","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/12761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=12761"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=12761"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=12761"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=12761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}