个人实用bat文件
发布日期:2021-05-07 13:43:05 浏览次数:18 分类:精选文章

本文共 6206 字,大约阅读时间需要 20 分钟。

在去各个学校机房,经常使用的bat文件。

关闭防火墙.bat 

NetSh Advfirewall set allprofiles state offpause

关闭休眠状态.bat

POWERCFG -Change -monitor-timeout-ac 0POWERCFG -Change -standby-timeout-ac 0pause;

刷新图标缓存.bat

rem 关闭Windows外壳程序explorertaskkill /f /im explorer.exerem 清理系统图标缓存数据库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 IconStreamsecho y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v PastIconsStreamrem 重启Windows外壳程序explorerstart explorer

 学校的机房一般都会安装有还原软件,时间一长/过了一寒暑假再开机,他电脑右下角就会出现留空现象,导致有些软件都没启动。此时就需要用到这个 “刷新图标缓存.bat”

为此,在计划任务设置,任何用户登录后,后30秒,运行此bat文件。

::延迟任务时间30秒::任何用户登录时 执行    ONSTART, ONLOGON, ONIDLE, ONEVENTschtasks /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 offcolor 0aecho 正在卸载IIS功能,这可能需要几分钟时间...start /w pkgmgr /uu:IIS-WebServerRole;WAS-WindowsActivationService;WAS-ProcessModel echo IIS已卸载成功!pauseexit

安装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 offset "path=%~dp0ConfigurationFile.ini"cd %~dp0SQLEXPR_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 offtitle --IP自动设置 -- MODE con: COLS=80 lines=30color 0a:menuclsecho ----------------------------------echo       请选择,输入数字按回车echo ----------------------------------echo.echo       设置直连网络IP 请按 1echo       设置为自动获取 请按 2echo       设置为代理IP   请按 3echo       设置IE代理     请按 4echo       清除IE代理     请按 5echo       查看当前IP     请按 6echo       退出           请按 7echo.set /p choice=      您的选择:echo.if "%choice%"=="1" goto ip1if "%choice%"=="2" goto ip2if "%choice%"=="3" goto ip3if "%choice%"=="4" goto ie4if "%choice%"=="5" goto ie5if "%choice%"=="6" goto ip6if "%choice%"=="7" goto endgoto menu:ip1echo 请输入最后一位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.68netsh interface ip set address "%INTERFACE%" static %IP% %MASK% %GATEWAY% 0netsh interface ip set dns "%INTERFACE%" static %DNS% PRIMARY@echo 设置完毕,自动退出!exit:ip2echo IP自动设置开始....echo.echo 自动获取IP地址....@rem  win7: name="本地连接"   win8: name = "以太网"netsh interface ip set address name = "本地连接" source = dhcpecho 自动获取DNS服务器....netsh interface ip set dns name = "本地连接" source = dhcp @echo 设置完毕,自动退出!exit:ip3echo 请输入最后一位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.216netsh interface ip set address "%INTERFACE%" static %IP% %MASK% %GATEWAY% 0netsh 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 offclscolor 0Aipconfig /allpause >nulgoto menu

批量访问某网站

@echo offSETLOCALset  /a var=10:startset /a var+=1start 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 startEXIT

 

批量ping 和批量telnet

ping的: 192.168.1.8008~8021for /L %D in (8008,1,8021) do ping 192.168.1.%Dtelnet的: (端口8008~8021)for /L %D in (8008,1,8021) do telnet 113.xx.xxx.xxx %D

 

上一篇:记一次网络风暴/网络环路
下一篇:批量下载某网站的图片

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年03月26日 23时17分19秒