個人實用bat文件

在去各個學校機房,經常使用的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

@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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章