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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
nono5551212
Posts: 3
Joined: 25 Jan 2011 12:32

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

#1 Post by nono5551212 » 25 Jan 2011 15:34

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

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

#2 Post by aGerman » 25 Jan 2011 16:14

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

Post Reply