Skip to content

Instantly share code, notes, and snippets.

@BenStigsen
Last active July 22, 2017 06:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save BenStigsen/4c22823230a797e226f9760438382c58 to your computer and use it in GitHub Desktop.
Was made to fix computer problems.
REM ( ------------ ))
REM (( Created By PhantomScripts ))
REM ( ------------ ))
:Configuration
@echo off
color 0A
mode 1000
REM // If folder "Files" exists say nothing ELSE create folder "Files"
if not exist Files\ ( mkdir Files ) ELSE echo.
REM // Giving it 1 second to create folder "Files"
echo Loading
timeout /t 1 > nul
REM // Enter the folder "Files"
cd Files
REM // Set up variables
set File=Fix-%random%
set CleanStatus=.
set CheckDriveStatus=.
set DefragStatus=.
set OptimizeStatus=.
set DefOptStatus=.
set FileFixStatus=.
set SystemFixStatus=.
set MemoryCheckStatus=.
REM // Create file
(echo :: Made with Overhaul ::) > "%File%.bat"
(echo :: by PhantomScripts ::) >> "%File%.bat"
(echo @echo off ) >> "%File%.bat"
(echo echo Remember to run this as admin) >> "%File%.bat"
(echo echo Press ENTER To Continue) >> "%File%.bat"
(echo pause ^> nul) >> "%File%.bat"
(echo cls ) >> "%File%.bat"
echo( >> "%File%.bat"
REM // Main Menu <--------- START
:Menu
Title Overhaul by PhantomScripts
set HERE=Menu
cls
echo(
echo All the commands below are ADDED to "%File%.bat"
echo The commands are NOT executed when writing them (Except for the "Other" category)
echo(
echo Drives:
echo -clean (Select Drive and It Will Clean It) [%CleanStatus%]
echo -checkdrive (Will check the selected drive for errors) {Useful for: USB + Computer} [%CheckDriveStatus%]
echo -defrag (Will defrag all drives) [%DefragStatus%]
echo -optimize (Will optimize all drives) [%OptimizeStatus%]
echo -defopt (Will defrag + optimize drives) [%DefOptStatus%]
echo(
echo System:
echo -filefix (Look For Corrupted Files and Fix Them) [%FileFixStatus%]
echo -systemfix (Will Repair The Windows System-Image) [Useful If -filefix doesn't fix it] [%SystemFixStatus%]
echo -memorycheck (Will check for any memory problems) [Might take a couple of hours] [%MemoryCheckStatus%]
echo [ADD THIS AS THE LAST THING (If you want to do a memory check)]
echo(
echo Other:
echo -details {Detailed Menu} (Shows each command (including parameters)) [Requires knowledge in the Batch language]
echo -done (To Stop Adding More)
echo(
set /p "Command=Command: " || goto %HERE%
if /i %Command%==clean goto Clean
if /i %Command%==filefix goto FileFix
if /i %Command%==systemfix goto SystemFix
if /i %Command%==checkdrive goto CheckDrive
if /i %Command%==defrag goto Defrag
if /i %Command%==optimize goto Optimize
if /i %Command%==defopt goto DefragOptimize
if /i %Command%==memorycheck goto MemoryCheck
if /i %Command%==details goto Details
if /i %Command%==done goto Script
:: |||||||||
if /i %Command%==-clean goto Clean
if /i %Command%==-filefix goto FileFix
if /i %Command%==-systemfix goto SystemFix
if /i %Command%==-checkdrive goto CheckDrive
if /i %Command%==-defrag goto Defrag
if /i %Command%==-optimize goto Optimize
if /i %Command%==-defopt goto DefragOptimize
if /i %Command%==-memorycheck goto MemoryCheck
if /i %Command%==-details goto Details
if /i %Command%==-done goto Script
goto Error
REM // Main Menu <--------- END
REM // Detailed Menu <---------- START
:Details
color 03
set HERE=Details
cls
echo(
echo All the commands below are ADDED to "%File%.bat"
echo The commands are NOT executed when writing them (Except for the "Other" category)
echo(
echo Drives:
echo -clean (Select Drive and It Will Clean It) [cleanmgr.exe]
echo -checkdrive (Will check the selected drive for errors) [chkdsk X /F /R] {X = User selected Drive}
echo -defrag (Will defrag all drives) [defrag /C /D)]
echo -optimize (Will optimize all drives) [defrag /C /G]
echo -defopt (Will defrag + optimize drives) [defrag /C /V /O]
echo(
echo System:
echo -filefix (Look for corrupted files and fix them) [sfc /scannow]
echo -systemfix (Will repair the Windows system-image) [DISM /Online /Cleanup-Image /RestoreHealth]
echo -memorycheck (Will check for any memory problems) [MdSched]
echo [ADD THIS AS THE LAST THING]
echo(
echo Other:
echo -back (Go back to the simple menu)
echo -done (To Stop Adding More)
echo(
set /p "Command=Command: " || goto %HERE%
if /i %Command%==clean goto Clean
if /i %Command%==filefix goto FileFix
if /i %Command%==systemfix goto SystemFix
if /i %Command%==checkdrive goto CheckDrive
if /i %Command%==defrag goto Defrag
if /i %Command%==optimize goto Optimize
if /i %Command%==defopt goto DefragOptimize
if /i %Command%==memorycheck goto MemoryCheck
if /i %Command%==back color 0A && goto Menu
if /i %Command%==done goto Script
:: |||||||||
if /i %Command%==-clean goto Clean
if /i %Command%==-filefix goto FileFix
if /i %Command%==-systemfix goto SystemFix
if /i %Command%==-checkdrive goto CheckDrive
if /i %Command%==-defrag goto Defrag
if /i %Command%==-optimize goto Optimize
if /i %Command%==-defopt goto DefragOptimize
if /i %Command%==-memorycheck goto MemoryCheck
if /i %Command%==-back color 0A && goto Menu
if /i %Command%==-done goto Script
goto Error
REM // Detailed Menu <---------- END
REM // CheckDrive <--------- START
:CheckDrive
cls
wmic logicaldisk get name
echo(
echo
echo(
echo Above you see all drives on the computer
echo What drive would you like to check?
echo -back (goto Menu)
echo(
set /p "Drive=Choice: " || goto CheckDrive
if /i %Drive%==A: set Drive=A: && goto CheckDriveAdd
if /i %Drive%==B: set Drive=B: && goto CheckDriveAdd
if /i %Drive%==C: set Drive=C: && goto CheckDriveAdd
if /i %Drive%==D: set Drive=D: && goto CheckDriveAdd
if /i %Drive%==E: set Drive=E: && goto CheckDriveAdd
if /i %Drive%==F: set Drive=F: && goto CheckDriveAdd
if /i %Drive%==G: set Drive=G: && goto CheckDriveAdd
if /i %Drive%==back goto %HERE%
:: |||||||||
if /i %Drive%==A set Drive=A: && goto CheckDriveAdd
if /i %Drive%==B set Drive=B: && goto CheckDriveAdd
if /i %Drive%==C set Drive=C: && goto CheckDriveAdd
if /i %Drive%==D set Drive=D: && goto CheckDriveAdd
if /i %Drive%==E set Drive=E: && goto CheckDriveAdd
if /i %Drive%==F set Drive=F: && goto CheckDriveAdd
if /i %Drive%==G set Drive=G: && goto CheckDriveAdd
if /i %Drive%==-back goto %HERE%
goto CheckDrive
:CheckDriveAdd
(echo echo Y ^| chkdsk %Drive% ^/F ^/R) >> "%File%.bat"
goto CheckDriveEnd
:CheckDriveEnd
set CheckDriveStatus=X
cls
echo(
echo Want to add another drive?
echo -yes
echo -no
set /p "YesNo=Choice: " || goto CheckDriveEnd
if /i %YesNo%==-yes goto CheckDrive
if /i %YesNo%==-no goto %HERE%
:: |||||||||
if /i %YesNo%==yes goto CheckDrive
if /i %YesNo%==no goto %HERE%
goto CheckDriveEnd
REM // CheckDrive <--------- END
REM // SystemFix <--------- START
:SystemFix
set SystemFixStatus=X
(echo DISM ^/Online ^/Cleanup-Image ^/RestoreHealth) >> "%File%.bat"
cls
echo(
echo SystemFix has now been added to %File%.bat
echo(
echo Press ENTER To Return To Menu
pause > nul
goto %HERE%
REM // SystemFix <--------- END
REM // Clean <--------- START
:Clean
set CleanStatus=X
(echo cleanmgr.exe) >> "%File%.bat"
cls
echo(
echo Clean has been added to %File%.bat
echo(
echo Press ENTER To Return To Menu
pause > nul
goto %HERE%
REM // Clean <--------- END
REM // MemoryCheck <--------- START
:MemoryCheck
set MemoryCheckStatus=X
(echo echo Y ^| MdSched) >> "%File%.bat"
cls
echo(
echo MemoryCheck has been added to %File%.bat
echo(
echo Press ENTER To Return To Menu
pause > nul
goto %HERE%
REM // MemoryCheck <--------- END
REM // FileFix <--------- START
:FileFix
set FileFixStatus=X
(echo sfc ^/scannow) >> "%File%.bat"
cls
echo(
echo FileFix has been added to %File%.bat
echo(
echo Want to add SystemFix? (Usually used as backup for FileFix)
echo -yes
echo -no
echo(
set /p "YesNo=Choice: " || goto CheckDriveEnd
if /i %YesNo%==-yes goto SystemFix
if /i %YesNo%==-no goto %HERE%
:: |||||||||
if /i %YesNo%==yes goto SystemFix
if /i %YesNo%==no goto %HERE%
goto FileFix
REM // FileFix <--------- END
REM // DefragOptimize <--------- START
:DefragOptimize
set DefOptStatus=X
(echo defrag ^/C ^/V ^/O) >> "%File%.bat"
cls
echo(
echo Defrag + Optimize has been added to %File%.bat
echo(
echo Press ENTER To Return To Menu
pause > nul
goto %HERE%
REM // DefragOptimize <--------- END
REM // Defrag <--------- START
:Defrag
set DefragStatus=X
(echo defrag ^/C ^/D) >> "%File%.bat"
cls
echo(
echo Defrag has been added to %File%.bat
echo(
echo Press ENTER To Return To Menu
pause > nul
goto %HERE%
REM // Defrag <--------- END
REM // Optimize <--------- START
:Optimize
set OptimizeStatus=X
(echo defrag ^/C ^/G) >> "%File%.bat"
cls
echo(
echo Optimize has been added to %File%.bat
echo(
echo Press ENTER To Return To Menu
pause > nul
goto %HERE%
REM // Optimize <--------- END
REM // Error Handling <---------- START
:Error
color 0C
cls
echo --------------------------
echo ERROR
echo ==========================
ping 1.1.1.1 -n 1 -w 250 > nul
cls
color 0A
goto %HERE%
REM // Error Handling <---------- END
REM // Finish Script <---------- START
:Script
cls
echo Did you add all the commands you wanted to add?
echo -yes
echo -no
echo(
set /p "YesNo=Choice: " || goto Script
if /i %YesNo%==-yes goto ScriptDone
if /i %YesNo%==-no goto %HERE%
:: |||||||||
if /i %YesNo%==yes goto ScriptDone
if /i %YesNo%==no goto %HERE%
goto Script
:ScriptDone
cls
echo( >> "%File%.bat"
(echo echo Restart your PC) >> "%File%.bat"
(echo pause ^> nul) >> "%File%.bat"
(echo :: Created with Overhaul ::) >> "%File%.bat"
(echo :: Made by PhantomScripts ::) >> "%File%.bat"
cls
echo The script "%File%.bat" is done and ready to go at "%cd%\Files\%File%.bat"
echo(
echo Press ENTER To Exit
pause > nul
exit
REM // Finish Script <---------- END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment