我想使用批处理脚本:
我读了here您可以使用
检查网络名称for /f "tokens=3" %%a in ('netsh wlan show interface ^| findstr /r "^....SSID"' ) do @echo %%a
因此,如果我想创建一个像这样的批处理脚本,它会是这样的吗?
for /f "tokens=3" %%a in ('netsh wlan show interface ^| findstr /r "^....SSID"' ) do (
if "%%a"=="My_Cool_Home_Network"
netsh interface ip set address "NetworkAdapter" static 192.168.2.33 255.255.255.0 192.168.2.1
netsh interface ip set dns "NetworkAdapter" static 192.168.2.1
else
netsh interface ip set address "NetworkAdapter" dhcp
netsh interface ip set dns "NetworkAdapter" dhcp
)