在CMD下读取服务器终端的端口的代码

复制代码 代码如下: regedit /...
复制代码 代码如下:

regedit /e c:\\tsport.reg “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp”
type c:\\tsport.reg | find “PortNumber”

执行后:如图所示

注意:上面的代码获取的是16进制端口(000000d3d),所以需要转换为10进制的,才是大家所熟悉的3389等端口。

附送在线16进制十进制互转工具 //www.jb51.net/tools/hexconv/

使用后:

Related Posts

Comments are closed.