Reputation: 365
I need to refresh the desktop ussing batch is this possible?
I have found the following VBscript that refreshes the containing window however, the desktop needs to be refreahed and its not the containing window
anyways around this?
Set WSHShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{F5}"
thx-
Upvotes: 10
Views: 43592
Reputation: 1978
Try this
@echo off
taskkill /fi "imagename eq explorer.exe" /f
CD /d %userprofile%\AppData\Local
DEL IconCache.db /a
START explorer.exe
Upvotes: 1
Reputation: 61016
You may try this:
rundll32 user32.dll,UpdatePerUserSystemParameters
Or this:
ie4uinit.exe -ClearIconCache
It is, however, version dependent.
Upvotes: 7
Reputation: 895
@echo off
setlocal EnableExtensions DisableDelayedExpansion
ie4uinit.exe -show
endlocal
Upvotes: 4
Reputation: 51
On Win7 this can be done by calling the function "SHChangeNotify" from "shell32.dll". The problem is that AFAIK this function can't be successfully loaded using "rundll32.exe", so instead use a program that can do it.
Use this CLI Refresh Tool from sepago website (32/64 bit images available for download)
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
DllCall("shell32.dll", "none", "SHChangeNotify", "long", 0x8000000, "uint", BitOR(0x0, 0x1000), "ptr", 0, "ptr", 0)
Upvotes: 5