<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>奋斗博客 &#187; cmd</title>
	<atom:link href="http://www.fendou.info/tag/cmd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fendou.info</link>
	<description>WordPress&#124;SEO&#124;Web&#124;Linux&#124;Windows&#124;Android</description>
	<lastBuildDate>Sat, 04 Feb 2012 13:56:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>批处理开启远程桌面</title>
		<link>http://www.fendou.info/open-remote-desktop-in-cmd/</link>
		<comments>http://www.fendou.info/open-remote-desktop-in-cmd/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 14:52:34 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[操作系统]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[psexec]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xp]]></category>
		<category><![CDATA[命令行]]></category>
		<category><![CDATA[远程桌面]]></category>

		<guid isPermaLink="false">http://www.fendou.info/?p=427</guid>
		<description><![CDATA[在大型网络中管理远程服务器最方便的就是用Windows远程桌面，但是有的时候又接触不到服务器，那么就需要远程开启远程桌面，方法很多，今天介绍一个简单的方法用命令行开启远程电脑的远程桌面服务。 <a href="http://www.fendou.info/open-remote-desktop-in-cmd/">继续阅读 <span class="meta-nav">&#8594;</span></a><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;"></font></b></td>
    </tr>
    
        <tr>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="浏览器也能连接远程桌面" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fexplorer-remote-desktop%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/20/11175202.gif" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">浏览器也能连接远程桌面</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何用手机远程控制电脑" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fhow-to-control-the-computer-remotely-using-a-mobile-phone%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/19/11100405.jpg" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何用手机远程控制电脑</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="XP 双开3389工具" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fxp-open-3389-tool%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2012/02/04/14760404.png" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">XP 双开3389工具</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="windows2003架设VPN穿越Juniper防火墙设置步骤" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fwindows2003-set-up-vpn%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/05/10325218.jpg" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">windows2003架设VPN穿越Juniper防火墙设置步骤</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="BAT版RAR分割工具 " style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fbat-rar-tool%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/24/11427723.jpg" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">BAT版RAR分割工具 </font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在大型网络中管理远程服务器最方便的就是用Windows远程桌面，但是有的时候又接触不到服务器，那么就需要远程开启远程桌面，方法很多，今天介绍一个简单的方法用命令行开启远程电脑的远程桌面服务。前提是要知道管理员的密码和和本地安全策略中网络访问模式应为“本地用户以自己的身份验证”。</p>
<p>一般windows2003的网络访问模式默认就是“本地用户以自己的身份验证”。而XP则是“本地账户以来宾的身份验证”，如何查看请打开运行输入cmd-&gt;gpedit.msc-&gt;计算机配置-&gt;本地策略-&gt;安全选项-&gt;网络访问：本地账户的共享和安全模式。有的时候不能访问Xp的默认共享就是因为这项的设置原因。</p>
<p>在以上前提条件下，我们就可以通过命令行来直接打开远程主机的远程桌面了。还要借助一个小工具Psexec。<span id="more-427"></span></p>
<blockquote><p>Psexec实用工具（如 Telnet）和远程控制程序（如 Symantec 的 PC Anywhere）使您可以在远程系统上执行程序，但安装它们非常困难，并且需要您在想要访问的远程系统上安装客户端软件。PsExec 是一个轻型的 telnet 替代工具，它使您无需手动安装客户端软件即可执行其他系统上的进程，并且可以获得与控制台应用程序相当的完全交互性。PsExec 最强大的功能之一是在远程系统和远程支持工具（如 IpConfig）中启动交互式命令提示窗口，以便显示无法通过其他方式显示的有关远程系统的信息。注意：某些反病毒扫描程序会报告其中的一个或多个工具感染了“远程管理”病毒。这些 PsTools 都不带病毒，但是如果病毒使用了这些工具，则它们可能触发病毒通知。</p></blockquote>
<p>好了，请看下面的批处理代码：</p>
<p>open.bat</p>

<div class="wp_syntax"><div class="code"><pre class="vbscript" style="font-family:monospace;">echo Windows Registry Editor Version 5.00&gt;3389.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]&gt;&gt;3389.reg
echo &quot;fDenyTSConnections&quot;=dword:00000000&gt;&gt;3389.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp]&gt;&gt;3389.reg
echo &quot;PortNumber&quot;=dword:00000d3d&gt;&gt;3389.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]&gt;&gt;3389.reg
echo &quot;PortNumber&quot;=dword:00000d3d&gt;&gt;3389.reg
regedit /s 3389.reg
del 3389.reg</pre></div></div>

<p>close.bat</p>

<div class="wp_syntax"><div class="code"><pre class="vbscript" style="font-family:monospace;">echo Windows Registry Editor Version 5.00&gt;3389.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]&gt;&gt;3389.reg
echo &quot;fDenyTSConnections&quot;=dword:00000001&gt;&gt;3389.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp]&gt;&gt;3389.reg
echo &quot;PortNumber&quot;=dword:00000d3d&gt;&gt;3389.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]&gt;&gt;3389.reg
echo &quot;PortNumber&quot;=dword:00000d3d&gt;&gt;3389.reg
regedit /s 3389.reg
del 3389.reg</pre></div></div>

<p>解释一下open.bat是开启远程桌面 close.bat是关闭远程桌面，比较一下只有两个键值不同。这两个注册表也可以适用用在本机直接运行就可以开启或关闭本机的远程桌面。</p>
<p>3389.bat 这个算是主程序吧</p>

<div class="wp_syntax"><div class="code"><pre class="vbscript" style="font-family:monospace;">@echo off
echo Input The Remote Server IP:
set /p IP=
echo Input The Remote Server Username:
set /p username=
echo Input The Remote Server Password:
set /p password=
echo Select you operation:
echo Open  Remote Desktop Press (o)
echo Close Remote Desktop Press (s)
set /p select=
if %select%==o psexec.exe \\%ip% -u %username% -p %password% -c open.bat	
if %select%==s psexec.exe \\%ip% -u %username% -p %password% -c close.bat</pre></div></div>

<p>运行后只要输入远程电脑的IP 用户名和密码 再选择是打开还是关闭远程桌面就可以了。此外还可以用<a href="http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html">Bat To Exe Converter</a>把bat转换成为exe文件。我做好了一个效果图如下：<br />
<img src="http://www.fendou.info/wp-content/uploads/2009/12/3389.PNG" alt="3389" title="3389" width="409" height="226" class="aligncenter size-full wp-image-430" /></p>
<p>bat源码和psexec下载点<a href="http://www.rayfile.com/zh-cn/files/1a3d122b-e4d2-11de-9ce3-0014221b798a/">这里</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;"></font></b></td>
    </tr>
    
        <tr>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="浏览器也能连接远程桌面" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fexplorer-remote-desktop%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/20/11175202.gif" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">浏览器也能连接远程桌面</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何用手机远程控制电脑" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fhow-to-control-the-computer-remotely-using-a-mobile-phone%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/19/11100405.jpg" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何用手机远程控制电脑</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="XP 双开3389工具" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fxp-open-3389-tool%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2012/02/04/14760404.png" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">XP 双开3389工具</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="windows2003架设VPN穿越Juniper防火墙设置步骤" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fwindows2003-set-up-vpn%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/05/10325218.jpg" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">windows2003架设VPN穿越Juniper防火墙设置步骤</font>
                    </a>
                </td>
                <td width="111" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="BAT版RAR分割工具 " style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.fendou.info%2Fbat-rar-tool%2F&from=http%3A%2F%2Fwww.fendou.info%2Fopen-remote-desktop-in-cmd%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 105px !important; height: 105px !important;" src="http://static.wumii.com/site_images/2011/11/24/11427723.jpg" width="105px" height="105px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 111px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">BAT版RAR分割工具 </font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.fendou.info/open-remote-desktop-in-cmd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

