cmd或shell下读终端端口
cmd或shell下读终端端口
1.通用方法
regedit /e c:\3389.reg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
type c:\3389.reg | find "PortNumber"
del c:\3389.reg
2.xp和2003下
reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp"
3.脚本
echo Dim ReadComputerName > c:\3389.vbs
echo Set ReadComputerName=WScript.CreateObject(^"WScript.Shell^") >> c:\3389.vbs
echo Dim TSName,TSRegPath >> c:\3389.vbs
echo TSRegPath=^"HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber^" >> c:\3389.vbs
echo TSName=ReadComputerName.RegRead(TSRegPath) >> c:\3389.vbs
echo WScript.Echo(^"Termservice Port:^"^&TSName) >> c:\3389.vbs
cscript 3389.vbs
该文章转载自网络大本营:http://www.xrss.cn/Dev/PC/20078715475.Html