netsh advfirewall set allprofiles state on -开启所有网络防火墙
netsh advfirewall set allprofiles state off -关闭所有网络防火墙
netsh advfirewall set privateprofile state on -开启专用网络防火墙
netsh advfirewall set privateprofile state off -关闭专用网络防火墙
netsh advfirewall set publicprofile state on -开启来宾或公用网络防火墙
netsh advfirewall set publicprofile state off -关闭来宾或公用网络防火墙
netsh advfirewall set domainprofile state on -开启域防火墙
netsh advfirewall set domainprofile state off -关闭域防火墙
旧方法:关闭&开启 关闭专用网络、来宾或公用网络防火墙(已弃用)
netsh firewall set opmode mode=disable profile=ALL -关闭专用网络
netsh firewall set opmode mode=enable profile=ALL -开启专用网络
netsh firewall set opmode mode=disable -关闭来宾或公用网络防火墙
netsh firewall set opmode mode=enable -开启来宾或公用网络防火墙
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
call:Close_Firewall
call:Turn_Off_Device_Hibernation
call:Change_User_Permissions
pause
exit
REM 关闭专用、来宾或公用网络防火墙
:Close_Firewall
netsh advfirewall set privateprofile state off >nul
netsh advfirewall set publicprofile state off >nul
echo The firewall is turned off
goto:eof
REM 计算机睡眠状态、休眠状态和关闭显示器设置为:从不
:Turn_Off_Device_Hibernation
powercfg -change -standby-timeout-ac 0
powercfg -change hibernate-timeout-ac 0
powercfg -change -monitor-timeout-ac 0echo The computer sleeptime and turning off the monitor have been set to never
goto:eof
REM 更改用户帐户控制设置为:从不通知
:Change_User_Permissions
reg add"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" /t "REG_DWORD" /d 0 /F >nul
echo The user account control setting has been changed to: Never notify
goto:eof