欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-04-10 18:45:17
复制代码 代码如下: regedit /e c:\\tsport.reg "hkey_local_machine\system\currentcontrolset\cont...
复制代码 代码如下:

regedit /e c:\\tsport.reg "hkey_local_machine\system\currentcontrolset\control\terminal server\winstations\rdp-tcp"
type c:\\tsport.reg | find "portnumber"


执行后:如图所示

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

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

附送在线16进制十进制互转工具

使用后:
在CMD下读取服务器终端的端口的代码