在去各个学校机房,经常使用的bat文件。
关闭防火墙.bat
NetSh Advfirewall set allprofiles state off
pause
关闭休眠状态.bat
POWERCFG -Change -monitor-timeout-ac 0
POWERCFG -Change -standby-timeout-ac 0
pause;
刷新图标缓存.bat
rem 关闭Windows外壳程序explorer
taskkill /f /im explorer.exe
rem 清理系统图标缓存数据库
attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db"
del /f "%userprofile%\AppData\Local\IconCache.db"
attrib /s /d -h -s -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_32.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_102.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1024.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.db"
rem 清理 系统托盘记忆的图标
echo y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v IconStreams
echo y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v PastIconsStream
rem 重启Windows外壳程序explorer
start explorer
学校的机房一般都会安装有还原软件,时间一长/过了一寒暑假再开机,他电脑右下角就会出现留空现象,导致有些软件都没启动。此时就需要用到这个 “刷新图标缓存.bat”
为此,在计划任务设置,任何用户登录后,后30秒,运行此bat文件。
::延迟任务时间30秒
::任何用户登录时 执行 ONSTART, ONLOGON, ONIDLE, ONEVENT
schtasks /create /tn shuaxin /tr "C:\Users\Administrator\Desktop\tubiao.bat" /sc ONLOGON /DELAY 0000:30
创建站点.bat
@set "sitePath=%~dp0"
@echo GzyExam
@C:\Windows\System32\inetsrv\appcmd.exe add apppool /name:"GzyExam" /managedRuntimeVersion:"v4.0"
@C:\Windows\System32\inetsrv\appcmd.exe add site /name:"GzyExam" /bindings:http/*:80: /applicationDefaults.applicationPool:"GzyExam" /physicalPath:%sitePath%
exit
卸载IIS.bat
@echo off
color 0a
echo 正在卸载IIS功能,这可能需要几分钟时间...
start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel
echo IIS已卸载成功!
pause
exit
安装IIS.bat
@echo off
echo 正在添加IIS8.0 功能,依据不同的网络速率,全程大约需要5分钟时间...
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-ASPNET45;IIS-NetFxExtensibility45;NetFx4Extended-ASPNET45;IIS-NetFxExtensibility;IIS-ASP;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
echo 祝贺您 IIS 8.0 已添加成功!
exit
恢复任务管理器.bat
@reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "DisableTaskMgr" /t REG_DWORD /d "0" /f>nul
安装sqlpress.bat
@echo off
set "path=%~dp0ConfigurationFile.ini"
cd %~dp0
SQLEXPR_x64_CHS.EXE /ConfigurationFile=%path% /AGTSVCPASSWORD="xxx" /ASSVCPASSWORD="xxx" /ISSVCPASSWORD="xxx" /RSSVCPASSWORD="xxx" /SAPWD="xxx" /Q
静默安装模板.bat
Teacher_2.7.13273.exe /verysilent /noscreendriver
IP绑定.bat
@rem 运行 : 右键菜单-〉以管理员身份运行
@echo off
title --IP自动设置 --
MODE con: COLS=80 lines=30
color 0a
:menu
cls
echo ----------------------------------
echo 请选择,输入数字按回车
echo ----------------------------------
echo.
echo 设置直连网络IP 请按 1
echo 设置为自动获取 请按 2
echo 设置为代理IP 请按 3
echo 设置IE代理 请按 4
echo 清除IE代理 请按 5
echo 查看当前IP 请按 6
echo 退出 请按 7
echo.
set /p choice= 您的选择:
echo.
if "%choice%"=="1" goto ip1
if "%choice%"=="2" goto ip2
if "%choice%"=="3" goto ip3
if "%choice%"=="4" goto ie4
if "%choice%"=="5" goto ie5
if "%choice%"=="6" goto ip6
if "%choice%"=="7" goto end
goto menu
:ip1
echo 请输入最后一位IP号:
set /p setip=
echo.
echo 直连IP绑定开始,请稍后....
@set INTERFACE=本地连接
@set IP=192.168.1.%setip%
@set MASK=255.255.255.0
@set GATEWAY=192.168.1.1
@set DNS=202.103.224.68
netsh interface ip set address "%INTERFACE%" static %IP% %MASK% %GATEWAY% 0
netsh interface ip set dns "%INTERFACE%" static %DNS% PRIMARY
@echo 设置完毕,自动退出!
exit
:ip2
echo IP自动设置开始....
echo.
echo 自动获取IP地址....
@rem win7: name="本地连接" win8: name = "以太网"
netsh interface ip set address name = "本地连接" source = dhcp
echo 自动获取DNS服务器....
netsh interface ip set dns name = "本地连接" source = dhcp
@echo 设置完毕,自动退出!
exit
:ip3
echo 请输入最后一位IP号:
set /p setip=
echo.
echo 代理IP绑定开始,请稍后....
@set INTERFACE=本地连接
@set IP=192.168.1.%setip%
@set MASK=255.255.255.0
@set GATEWAY=192.168.1.111
@set DNS=222.52.118.216
netsh interface ip set address "%INTERFACE%" static %IP% %MASK% %GATEWAY% 0
netsh interface ip set dns "%INTERFACE%" static %DNS% PRIMARY
@echo 设置完毕,自动退出!
exit
:ie4
@echo off
echo 开始设置IE代理上网
@rem 172.88.28.10:80 修改为自己要设置的代理以及端口
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "172.88.28.10:80" /f
@echo 设置代理完毕,自动退出!
exit
:ie5
@echo off
echo 开始清除IE代理设置
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f
echo IE代理清除完毕,自动退出!
exit
:ip6
@echo off
cls
color 0A
ipconfig /all
pause >nul
goto menu
批量访问某网站
@echo off
SETLOCAL
set /a var=10
:start
set /a var+=1
start chrome.exe "http://192.168.xxx.xxx:8008/CertificateDownLoad.html?QID=489&UserName=%E6%9D%8&TRID=1065"
::注释 url也可带参数变量,比如
::start chrome.exe https://xx.xx.com/jw/flow_test.jsp?StepID=%var%"&RunMode=2"
if %var% leq 30 GOTO start
EXIT
批量ping 和批量telnet
ping的: 192.168.1.8008~8021
for /L %D in (8008,1,8021) do ping 192.168.1.%D
telnet的: (端口8008~8021)
for /L %D in (8008,1,8021) do telnet 113.xx.xxx.xxx %D