-
Notifications
You must be signed in to change notification settings - Fork 0
/
refresh_icon_cache.bat
47 lines (42 loc) · 1.09 KB
/
refresh_icon_cache.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo off
:: Script to clear the icon cache and restart Windows Explorer
:: Check for Administrator privileges
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Prompting for Administrator access...
powershell -Command "Start-Process -FilePath '%~f0' -ArgumentList '-runElevated' -Verb RunAs"
exit /b
)
:: Confirm clearing icon cache
set /p clearCache="Are you sure you want to clear the icon cache? (Y/N): "
if /i not "%clearCache%"=="Y" (
echo Operation cancelled by user.
pause
exit /b
)
:: Clear the icon cache using ie4uinit.exe
echo Clearing icon cache...
ie4uinit.exe -ClearIconCache
if %errorLevel% neq 0 (
echo Error clearing icon cache.
pause
exit /b
)
:: Restart Windows Explorer
echo Restarting Windows Explorer...
taskkill /f /im explorer.exe >nul
if %errorLevel% neq 0 (
echo Error stopping Windows Explorer.
pause
exit /b
)
timeout /t 3 >nul
start explorer.exe
if %errorLevel% neq 0 (
echo Error starting Windows Explorer.
pause
exit /b
)
echo Operation completed successfully.
pause
exit /b