@echo off
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
@echo off & cd /d %~dp0
set Length=8
set Complexity=1
(echo [Version]
echo signature="$CHICAGO$"
echo [System Access]
echo MinimumPasswordLength = %Length%
echo PasswordComplexity = %Complexity%)>Password.inf
secedit /configure /db Password.sdb /cfg Password.inf /log Password.log
del Password.*
gpupdate /force
exit
::pause
使用文本编辑器,保存为.bat结尾的批处理文件,右键以管理员权限运行。