Skip to content

Commit a49048a

Browse files
committed
win-script/git: Fixed explorer.exe requested_FIX and added .history_DIR to cleaning list
Signed-off-by: KARTHIK LAL <[email protected]>
1 parent a7ee628 commit a49048a

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

clean-win.bat

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ if %errorLevel% == 0 (
4747
exit /b 1
4848
)
4949

50-
5150
@REM Abort the script if there is any pending restart/reboot.
5251
@REM Security check [2/3]
5352
@REM Abort if any restart is pending
@@ -171,15 +170,21 @@ exit /b 1
171170

172171
:EULA_Accepted
173172

174-
@REM lets make it look like a real program :)
175-
echo BYE BYE EXPLORER.exe
176-
@REM Timeout is used to make the script wait for 1 seconds
177-
timeout /t 1
178-
@REM Clear the screen
179-
cls
180-
@REM Kill the explorer.exe
181-
taskkill /f /im explorer.exe
173+
@REM Ask user for killing the explorer.exe process
174+
echo Do you want to kill the explorer.exe process? (Y/N)
182175

176+
set /p Explorer_Answer= Y/N:
177+
178+
if /i "%Explorer_Answer%" == "Y" (
179+
echo Killing explorer.exe process...
180+
taskkill /f /im explorer.exe
181+
) else (
182+
echo Not killing explorer.exe process...
183+
goto CTL
184+
)
185+
186+
@REM Continue the script
187+
:CTL
183188
@REM Clearing DNS cache
184189
echo Clearing DNS cache
185190
@REM Flush DNS cache
@@ -283,6 +288,13 @@ timeout /t 1
283288
@REM Delete all the files in the recent files folder ~ clearing the recent files folder having some issues on windows 11 (not sure why)
284289
del /f /s /q "%userprofile%\recent\*.*"
285290

291+
@REM Delete all the files in the history folder
292+
echo Removing history files
293+
@REM Timeout is used to make the script wait for 1 seconds
294+
timeout /t 1
295+
@REM Delete all the files in the history folder
296+
del /f /s /q "%userprofile%\local settings\history\*.*"
297+
286298
@REM Repair System Image (used by sfc /scannow to fix corrupted files)
287299
echo Repairing System Image (using Windows Update if needed)
288300
@REM Timeout is used to make the script wait for 1 seconds
@@ -320,10 +332,11 @@ reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /f
320332
@REM Clear the console
321333
cls
322334

323-
@REM Lets make it look like a real program :)
324-
echo Welcome back explorer.exe
325-
@REM Restart the explorer.exe which we already killed earlier
326-
explorer.exe
335+
@REM Start explorer.exe only if it is not running
336+
echo Starting explorer.exe
337+
@REM Timeout is used to make the script wait for 1 seconds
338+
timeout /t 1
339+
tasklist /fi "imagename eq explorer.exe" | find /i "explorer.exe" >nul || start explorer.exe
327340

328341
@REM GREETINGS FROM THE DEVELOPER (KARTHIK LAL) :)
329342

0 commit comments

Comments
 (0)