使用方法:
1.打开文本编辑工具如(Notepad++)
2.新建文件
3.注意:修改文本的编码字符集为:gb2312
4.将下面代码 复制入文件
5.保存文件名为:transmit.bat
6.双击运行 transmit.bat 即可食用
@echo off setlocal enabledelayedexpansion ::判断是否为管理员打开 net.exe session 1>NUL 2>NUL && ( goto start ) || ( goto UACPrompt ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%getadmin.vbs" "%temp%getadmin.vbs" exit /B :start choice /C 1234 /T 15 /D 3 /M "1.查看所有转发列表,2.映射端口,3.删除映射,4.退出" if errorlevel 4 goto ext if errorlevel 3 goto del if errorlevel 2 goto add if errorlevel 1 goto list :list echo ===============================list=============================== netsh interface portproxy show all echo ================================================================== pause goto start :add set /p listenaddress=请输入监听的ip地址: set /p listenport=请输入监听的端口: set /p connectaddress=请输入转发目标的ip地址: set /p connectport=请输入转发目标的端口: echo use "netsh interface portproxy add v4tov4 listenaddress=!listenaddress! listenport=!listenport! connectaddress=!connectaddress! connectport=!connectport!" netsh interface portproxy add v4tov4 listenaddress=!listenaddress! listenport=!listenport! connectaddress=!connectaddress! connectport=!connectport! goto list :del set /p listenaddress=请输入监听的ip地址: set /p listenport=请输入监听的端口: echo use "netsh interface portproxy del v4tov4 listenport=!listenport! listenaddress=!listenaddress!" netsh interface portproxy del v4tov4 listenport=!listenport! listenaddress=!listenaddress! goto list :ext exit