Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Refresh desktop with a batch (no "Sendkeys F5")

01 May 2013   #1

Windows 7
Refresh desktop with a batch (no "Sendkeys F5")

I'm not an expert in Windows scripts and programming, but Googling around I've found this code to refresh the desktop/active folder:

set oWSH = wscript.CreateObject("Wscript.Shell")
Hme = "Home - Microsoft Internet Explorer"
wscript.sleep 1000
oWSH.SendKeys "{F5}"
The problem is that the desktop (or the folder) must be the active window; for exaple, if I launch the command from a shortcut on the taskbar, the desktop won't be active and it won't refresh (unless I click on the desktop in less than one second); I could increase the wscript.sleep to have more time to click on the desktop, but it won't be comfortable then.

Is there another smarter way to refresh the desktop?

Thanks in advice.

My System SpecsSystem Spec

01 May 2013   #2

Windows 8.1 Pro (x64)

Press the F5 key on your keyboard yourself? Tho I don't understand the requirements.
My System SpecsSystem Spec
01 May 2013   #3

Windows 7

No... I'd like to automate the action, so I don't have to press the key!

(This is a part of another script that toggles hidden files visualization)
My System SpecsSystem Spec

01 May 2013   #4

Windows 8.1 Pro + Windows 10

set it up with task scheduler
My System SpecsSystem Spec

 Refresh desktop with a batch (no "Sendkeys F5")

Thread Tools

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 01:34 AM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

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