bugfixer.bat batch file ask end user which option they want to run
Manager has just bought a humdinger of a utility. It does everything. It even has command line functionality. If you run BugFixer /a the application will automatically scan the entire drive for cooties. If you run the Bugfixer /b it will scan all of your files on the Windows\system 32 directory and if you run Bugfixer /c the program will scan and repair your Registry. Need to write a batch file that will allow your users to avoid that pesky GUI and efficiently run the Bug fixer through the command line, by asking them which option they would like to initialize.
: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
Like I said fun stuff. Anyone wanna help?
Next script logic could become helpful:
@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
However, running it:
==>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 ==>
Resources (advised reading):
- An A-Z Index of the Windows CMD command line (command reference)
- Windows CMD Shell Command Line Syntax (additional particularities)
- Script resources for IT professionals (a huge Script repository)