十分实用的BAT命令
个人整理的一些十分实用的BAT命令中,可以直接粘贴到文本文件中,在改名为*.BAT文件即可运行奇。
“《”和“》”之间行的内容就是bat命令文件的内容,不含“《”和“》”。
●定时关机命令:shutdown
定时关机命令.bat——7200就是两小时,可根据需要修改数字改变定时时间。
《
echo off
echo DOS命令格式:
echo shutdown /s /t ???(秒)
echo shutdown /a 取消
echo 一小时(3600秒)后关机命令如下:
shutdown /s /t 7200
》
●修改IP地址命令:netsh interface ip
修改IP地址命令.bat——可根据需要增删语句
《
@echo off
echo 正在设置,请稍后。
rem 修改IP地址命令***
rem固定IP
netsh interface ip set address "本地连接" static 192.168.169.99 255.255.255.0 192.168.169.1 1
rem 上网自动获得IP
netsh interface ip set address "本地连接" DHCP
rem 修改DNS地址命令***
rem 3G上网主DNS---固定IP-电信
netsh interface ip set dns "本地连接" source=static addr=115.168.254.1 rem 3G上网辅DNS---固定IP
netsh interface ip add dns "本地连接" addr=115.168.254.2 index=2
rem 宽带上网主DNS---固定IP-电信宽带
netsh interface ip set dns "本地连接" source=static addr=202.96.128.86 rem 宽带辅网主DNS---固定IP-电信宽带
netsh interface ip add dns "本地连接" addr=202.96.128.143 index=2
rem上网自动获得DNS IP
netsh interface ip set dns "本地连接" DHCP
:End
echo Good job!....
》
●删除Windows最近使用文档
删除Windows最近使用文档.bat
《
@echo off
rem 删除或显示Windows最近使用文档
if exist C:\Users\user\AppData\Roaming\Microsoft\Windows\Recent\. goto Win7 if exist C:\Docume~1\user\Recent\. goto XP
rem DOS下不支持windows长文件名,故用Docume~1代替Documents and Settings
rem 很奇怪,Win7下同样存在“C:\Docume~1\user\Recent\”,且与“C:\Users\user\AppData\Roaming\Microsoft\Windows\Recent\”是同一个文件夹。
但使用del C:\Docume~1\user\Recent\*.*却找不到文件。
goto End
:XP
rem Windows XP最近使用的文档目录,以下两句命令(explorer & del)如不需执行,则在命令行前加“rem ”
explorer C:\Documents and Settings\user\Recent
rem 如要删除XP最近使用的文档,执行下一句:
del C:\Docume~1\user\Recent\*.* /Q
echo 已删除XP最近使用的文档。
goto End
:Win7
rem Windows 7最近使用的文档目录,以下两句命令(explorer & del)如不需执行,则在命令行前加“rem ”
explorer C:\Users\user\AppData\Roaming\Microsoft\Windows\Recent rem 如要删除Win7最近使用的文档,执行下一句:
del C:\Users\user\AppData\Roaming\Microsoft\Windows\Recent\*.* /Q
echo 已删除Win7最近使用的文档。
:End
echo Good job!....
》。