bugfixer.bat 批处理文件询问最终用户他们想要哪个选项 运行

bugfixer.bat batch file ask end user which option they want to run

有趣的东西!!

经理刚刚买了一个实用的 humdinger。它无所不能。它甚至具有命令行功能。如果您 运行 BugFixer /a 应用程序将自动扫描整个驱动器以查找虱子。如果您 运行 Bugfixer /b 它将扫描 Windows\system 32 目录中的所有文件,如果您 运行 Bugfixer /c 程序将扫描并修复您的注册表。需要编写一个批处理文件,让您的用户通过命令行避免讨厌的 GUI 并有效 运行 错误修复程序,方法是询问他们想要初始化哪个选项。

:TOP 
ECHO WHICH BUG FIXER DO YOU NEED TO RUN? A=ALL B=SOME c=REPAIR 
SET /P = %USERSPEC% 
IF "%1"=="A=ALL" GO TO :FIRST 
IF "%1"=="A=all" GO TO :FIRST 
:FIRST
CHKDSK C:
ECHO CHECKING ALL FILES ARE COMPLETE 
IF "%2"=="B=SOME" GO TO :NEXT
IF "%2"=="b=some" GO TO :NEXT 
:NEXT 
CHKDSK /F /R C:\WINDOWS/SYSTEM32 
ECHO CHECKING SOME FILES ARE COMPLETE 
IF "%3"=="REPAIR" GO TO :LAST 
IF "%3"=="repair" GO TO :LAST 
:LAST
CHKDSK /c 
ECHO REPAIR FILES ARE COMPLETED

就像我说的有趣的东西。有人愿意帮忙吗?

下一个脚本逻辑可能会有所帮助:

@echo OFF >NUL
setlocal enableextensions
:TOP
echo(
set "USERSPEC="
set /P "USERSPEC=Which bug fixer do you need to run? A=all B=some C=repair? "
if /I "%USERSPEC%"=="A" goto :FIRST 
if /I "%USERSPEC%"=="B" goto :NEXT  
if /I "%USERSPEC%"=="C" goto :LAST
echo NO CHECK CHOOSEN, BATCH ENDS
goto :ENDSCRIPT

:FIRST
chkdsk C:
echo CHECKING ALL FILES ARE COMPLETE 
goto :TOP

:NEXT 
chkdsk /F /R C:\WINDOWS/SYSTEM32 
echo CHECKING SOME FILES ARE COMPLETE 
goto :TOP

:LAST
chkdsk /c 
echo REPAIR FILES ARE COMPLETED
goto :TOP

:ENDSCRIPT
endlocal
goto :eof

然而,运行它:

==>30019117.bat

Which bug fixer do you need to run? A=all B=some C=repair? a
Access Denied as you do not have sufficient privileges.
You have to invoke this utility running in elevated mode.
CHECKING ALL FILES ARE COMPLETE

Which bug fixer do you need to run? A=all B=some C=repair?
NO CHECK CHOOSEN, BATCH ENDS

==>

资源(建议阅读):