下面記錄一下.bat檔案編寫格式
1.自動修改計算機IP設定
@echo off
:start
echo ============請輸入數字選擇下一步操作:
echo ============1:ip設定為12樓會議室
echo ============2:設定為DHCP自動擷取ip
set /P var=":"
if %var%==1 goto ip1
if %var%==2 goto ipdhcp
:ip1
cls
netsh interface ip set address name="本地連接配接" source=static
addr=10.25.1.89 mask=255.255.255.0 gateway=10.25.1.254
cmd /c netsh interface ip set dns "本地連接配接" source=static
addr=192.168.254.13
echo **IP設定為12樓會議室的10.25.1.89,設定成功**
echo ------------------------------------------
goto start
:ipdhcp
cls
netsh interface ip set address name="本地連接配接" source=dhcp
netsh interface ip delete dns "本地連接配接" all
ipconfig /flushdns
echo **IP設定為DHCP擷取,設定成功**
echo ------------------------------------------
goto start
2.直接登入URL
start https://www.baidu.com/