天天看点

批处理文件(.bat)编写

下面记录一下.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/
           

继续阅读