Windows10开启网卡间Internet连接共享
cscript /nologo %~dp0\ics.vbs "WLAN" "vEthernet (Default Switch)" 1
将WLAN共享到vEthernet (Default Switch)网络,1为启用,0为禁用
以下脚本将网卡vEthernet (Default Switch)设置ip和掩码
@ECHO OFF
netsh interface set interface "vEthernet (Default Switch)" enabled
choice /t 5 /d y /n >nul
:C
FOR /F "TOKENS=3 DELIMS= " %%i IN ( 'netsh interface ip show addr "vEthernet (Default Switch)"') DO (
ECHO %%i
IF "%%i" NEQ "192.168.100.1" (
ECHO "FAILURE"
) ELSE (
ECHO "SUCCESS"
GOTO EXIT
)
)
netsh interface ip set address name="vEthernet (Default Switch)" source=static addr=192.168.100.1 mask=255.255.255.0
REM netsh interface set interface "vEthernet (Default Switch)" disabled
REM choice /t 3 /d y /n >nul
REM netsh interface set interface "vEthernet (Default Switch)" enabled
choice /t 5 /d y /n >nul
GOTO C
START TEST.BAT
:EXIT
cscript /nologo %~dp0\ics.vbs "WLAN" "vEthernet (Default Switch)" 1
@ECHO ON
EXIT
@ECHO &PAUSE
添加到任务计划即可以实现开启管理员权限启动。