批处理写vbs文件读取3889登陆端口

Echo Dim ReadComputerName >>mstsc.vbs
Echo Set ReadComputerName=WScript.CreateObject("WScript.Shell") >>mstsc.vbs
Echo Dim TSName,TSRegPath >>mstsc.vbs
Echo TSRegPath="HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber" >>mstsc.vbs
Echo TSName=ReadComputerName.RegRead(TSRegPath) >>mstsc.vbs
Echo WScript.Echo("TermService port is:"^&TSName) >>mstsc.vbs
Cscript mstsc.vbs


以上为批处理内容,运行后将在本目录下生成一个mstsc.vbs文件,
mstsc.vbs文件内容如下

Dim ReadComputerName
Set ReadComputerName=WScript.CreateObject("WScript.Shell")
Dim TSName,TSRegPath
TSRegPath="HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber"
TSName=ReadComputerName.RegRead(TSRegPath)
WScript.Echo("TermService port is:"&TSName)

引用通告地址: 点击获取引用地址
评论: 0 | 引用: 0 | 阅读: 553 | 打包 | 转发
发表评论
昵 称: 密 码:
网 址: 邮 箱:
验证码: 验证码图片 选 项:
头 像:
内 容:
  • 粗体
  • 斜体
  • 下划线
  • 插入图像
  • 超链接
  • 电子邮件
  • 插入引用
  • 表情符号