cmd在不借用第三方工具是难以实现端口级的应用的。不过你用的什么代理软件?难道客户端不会自动搜索并连接的吗?建议你去找一个可以自动搜索的用。
另外,不清楚你用的代理软件的工作原理,否则可以有针对性地来实现目的。怀疑重点应该是更改网关上面,不用它的客户端就用netsh就可以搞定。
附判断对方是否开启某个端口的vbs脚本如下:
host=inputbox("输入主机名或IP:")
port=inputbox("端口:")
Set socket=WScript.CreateObject("MSWinsock.Winsock","winsock_")
socket.Protocol=0
socket.RemotePort=port
socket.RemoteHost=host
socket.connect
for a=1 to 30
WScript.sleep 10
next
msgbox("端口 "&socket.remoteport&" 被关闭!")
socket.close
WScript.quit
Sub winsock_connect()
msgbox("端口 "&socket.remoteport&" 已打开!")
socket.close
WScript.quit
end sub
保存为 查看端口.vbs 后运行即可,须注册MSWinsock控件。
It is difficult for cmd to achieve port-level applications without borrowing third-party tools. But what proxy software are you using? Doesn't the client automatically search and connect? It is suggested that you find one that can automatically search to use.
In addition, I don't know the working principle of the proxy software you are using, otherwise the purpose can be achieved pertinently. It is suspected that the key should be to change the gateway. Without its client, you can use netsh to get it done.
The following is a VBS script to judge whether the other party has enabled a certain port:
host=inputbox("Enter the host name or IP:")
port=inputbox("Port:")
Set socket=WScript.CreateObject("MSWinsock.Winsock","winsock_")
socket.Protocol=0
socket.RemotePort=port
socket.RemoteHost=host
socket.connect
for a=1 to 30
WScript.sleep 10
next
msgbox("Port "&socket.remoteport&" is closed!")
socket.close
WScript.quit
Sub winsock_connect()
msgbox("Port "&socket.remoteport&" is open!")
socket.close
WScript.quit
end sub
Save it as "Check Port.vbs" and then run it. The MSWinsock control needs to be registered.