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
Trial4life

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

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

Code:
set oWSH = wscript.CreateObject("Wscript.Shell")
Hme = "Home - Microsoft Internet Explorer"
oWSH.appActivate(Hme)
wscript.sleep 1000
oWSH.appActivate(hme)
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
logicearth

Windows 10 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
Trial4life

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
Dude

Windows 10 Pro X64
 
 

set it up with task scheduler
My System SpecsSystem Spec
Reply

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




Thread Tools




Similar help and support threads
Thread Forum
WEI can't get past running test "Direct3D 10 Batch Assessment"
Hello. Hope everybody is doing fine. So, after installing another 4GB stick of RAM and my trusted SSD, it was time for a refresh on the WEI. But before I get to that, let me take you back a few days ago, when I got myself a new laptop (:party:), a Lenovo Z710 (i3-4000M, GT 745M, 4GB DDR3L...
Performance & Maintenance
question - batch file only works with "unofficial" directory name
Hello... I'm using a command line batch file to backup files from my W7 Pro x64 machine to an external USB HD. Basically, "xcopy c:\......\my documents\*.*" "external HD". I couldn't get this to work until I truncated the source directory to "documents" instead of "my documents" . While the batch...
General Discussion
"Noise" display - loss of sync? refresh problem? cause?
gang I confess this is a Vista-related problem but I need an idea or three. this is a good fast hp minitower, Athlon x64-based, that I previously CAREfully reworked Vista Business on and had it lean/mean/clean and fast. A year later it needed work - when booting up normally and logging in to the...
Graphic Cards
Move "Computer" and "[username]" out from under Desktop in Explorer?
Hello, nice peoples that provide so many fixes to make Windows suck less. I've been looking for hours, but the terms are so general I can't find anything. When I open up Windows Explorer, the "Computer", my profile folder, and the Recycle Bin all appear under "Desktop". Which makes finding...
Customization
Default Refresh "Out of Range". Can't see screen
:cry: I've been here before and cannot remember if I had to go into the registry or what.... I had a systemboard problem. saved my hard drive and memory, swapped out the system board for one that is similar but not exact, so I'm just now rebuilding things. Win7 Ultimate edition booted right...
Graphic Cards


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 21:59.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App