Page 1 of 1

F5 Key - Need to simulate at end of batch Win 7

Posted: 25 Jan 2011 15:34
by nono5551212
I have a batch file that works great but I need at the very end to refresh windows explorer

Pretty much is there a way in a batch file that I can activate the F5 key or refresh windows explorer?

Thanks

Note that this will work in Windows XP but not in Windows 7

Code: Select all

%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

Re: F5 Key - Need to simulate at end of batch

Posted: 25 Jan 2011 16:14
by aGerman
Unfortunately there is no command to refresh the explorer window.
A VBScript could send F5 to the active window, but the active window is the batch window :wink:
You have to launch it asynchronously with a small delay.

Try:

Code: Select all

@echo off
::your code

>"%temp%\tmp.vbs" echo WScript.Sleep 2000 : CreateObject("WScript.Shell").SendKeys "{F5}"
start "" "%temp%\tmp.vbs"


Regards
aGerman