复制代码,另存为 xxx.bat
文件
@echo off
title 预定义命令组
:head
@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" )
cls
echo 1.清理磁盘只读属性
echo.
echo 5.退出
echo.
set /p option=执行命令:
if "%option%"=="1" goto a
if "%option%"=="5" exit
cls & echo 超出预定命令,请重新输入! & pause & goto head
:a
cls
@echo off
attrib -r -s /s a:\*.*
attrib -r -s /s b:\*.*
attrib -r -s /s d:\*.*
attrib -r -s /s e:\*.*
attrib -r -s /s f:\*.*
attrib -r -s /s g:\*.*
attrib -r -s /s h:\*.*
attrib -r -s /s i:\*.*
attrib -r -s /s j:\*.*
attrib -r -s /s k:\*.*
attrib -r -s /s l:\*.*
attrib -r -s /s m:\*.*
attrib -r -s /s n:\*.*
attrib -r -s /s o:\*.*
attrib -r -s /s p:\*.*
attrib -r -s /s q:\*.*
attrib -r -s /s r:\*.*
attrib -r -s /s s:\*.*
attrib -r -s /s t:\*.*
attrib -r -s /s u:\*.*
attrib -r -s /s v:\*.*
attrib -r -s /s w:\*.*
attrib -r -s /s x:\*.*
attrib -r -s /s y:\*.*
attrib -r -s /s z:\*.*
pause & goto head
:h
cls
pause & goto head