批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程
[批处理文件精品]批处理版照片整理器[批处理文件精品]纯批处理备份&还原驱动在线第三方下载
返回列表 发帖

[系统相关] [已解决]关闭更新,安全中心,防火墙

本帖最后由 MF9593 于 2020-3-24 21:05 编辑

怎么通过批处理把以下功能给关闭
系统环境:win10
1.关闭系统更新
2.关闭防火墙
3.关闭安全中心,就是微软自带的杀毒
4.关闭通知提示,就是UAC

本帖最后由 smss 于 2020-3-25 12:36 编辑
  1. @ECHO OFF & PUSHD "%CD%" && CD /D "%~DP0"
  2. >NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
  3.     ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
  4.     ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
  5.     "%TEMP%\Getadmin.vbs"
  6.     DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
  7.     Exit /b
  8. )
  9. ::关闭通知需重启
  10. reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f>nul
  11. ::临时关闭Defender实时保护
  12. ver|find /i "10.0">nul
  13. if %errorlevel% == 0 (PowerShell "if((Get-MpPreference).DisableRealtimeMonitoring){Set-MpPreference -DisableRealtimeMonitoring 0}else{Set-MpPreference -DisableRealtimeMonitoring 1}")
  14. echo  结束进程 / Stopping Process...
  15. taskkill /im Windows10UpgraderApp.exe 2>nul
  16. echo  添加防火墙规则 / Adding firewall rules...
  17. netsh advfirewall firewall add rule name="Block_Windows10UpgraderApp" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\Windows10UpgraderApp.exe" action=block
  18. netsh advfirewall firewall add rule name="Block_WinREBootApp32" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\WinREBootApp32.exe" action=block
  19. netsh advfirewall firewall add rule name="Block_WinREBootApp64" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\WinREBootApp64.exe" action=block
  20. netsh advfirewall firewall add rule name="Block_bootsect" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\bootsect.exe" action=block
  21. netsh advfirewall firewall add rule name="Block_DW20" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\DW20.EXE" action=block
  22. netsh advfirewall firewall add rule name="Block_DWTRIG20" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\DWTRIG20.EXE" action=block
  23. netsh advfirewall firewall add rule name="Block_GatherOSState" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\GatherOSState.EXE" action=block
  24. netsh advfirewall firewall add rule name="Block_GetCurrentRollback" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\GetCurrentRollback.EXE" action=block
  25. netsh advfirewall firewall add rule name="Block_HttpHelper" dir=in program="%SYSTEMDRIVE%\Windows10Upgrade\HttpHelper.exe" action=block
  26. netsh advfirewall firewall add rule name="Block_UpdateAssistant" dir=in program="%SYSTEMROOT%\UpdateAssistant\UpdateAssistant.exe" action=block
  27. netsh advfirewall firewall add rule name="Block_UpdateAssistantCheck" dir=in program="%SYSTEMROOT%\UpdateAssistant\UpdateAssistantCheck.exe" action=block
  28. netsh advfirewall firewall add rule name="Block_Windows10Upgrade" dir=in program="%SYSTEMROOT%\UpdateAssistant\Windows10Upgrade.exe" action=block
  29. netsh advfirewall firewall add rule name="Block_UpdateAssistantV2" dir=in program="%SYSTEMROOT%\UpdateAssistantV2\UpdateAssistant.exe" action=block
  30. netsh advfirewall firewall add rule name="Block_UpdateAssistantCheckV2" dir=in program="%SYSTEMROOT%\UpdateAssistantV2\UpdateAssistantCheck.exe" action=block
  31. netsh advfirewall firewall add rule name="Block_Windows10UpgradeV2" dir=in program="%SYSTEMROOT%\UpdateAssistantV2\Windows10Upgrade.exe" action=block
  32. echo  设置ACL / Configurating ACL...
  33. echo y|cacls C:\Windows\UpdateAssistant\*.exe /t /p everyone:n 2>nul
  34. echo y|cacls C:\Windows10Upgrade\*.exe /t /p everyone:n 2>nul
  35. echo  停止Windows Update服务 / Disable Windows Update
  36. net stop wuauserv
  37. sc config wuauserv start= disabled
  38. echo 删除计划任务
  39. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistant" /f 2>nul
  40. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistantAllUsersRun" /f 2>nul
  41. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistantCalendarRun" /f 2>nul
  42. schtasks /delete /TN "\Microsoft\Windows\UpdateOrchestrator\UpdateAssistantWakeupRun" /f 2>nul
  43. echo  设置注册表 Editing Registry...
  44. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v DoNotConnectToWindowsUpdateInternetLocations /t REG_DWORD /d 1 /f>nul
  45. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" /v NoAutoUpdate /t REG_DWORD /d 1 /f>nul
复制代码
1

评分人数

TOP

回复 2# smss


    添加防火墙规则那里不太理解,是关闭系统更新还是关闭防火墙?

TOP

它们是关联的添加防火墙规则才能关闭系统更新

TOP

回复 3# MF9593


仔细看代码!!
关闭了系统更新
删除了系统升级提醒
(这应该针对WIN7特定的,会提示升级到WIN10)

TOP

返回列表