We help IT Professionals succeed at work.
Get Started

How to close or refresh an Explorer window from a command line?

Nosliwde
Nosliwde asked
on
3,689 Views
Last Modified: 2012-05-05
Scenario: Multiple inexperienced users on tablets that are not always connected to a printer, and documents containing sensitive data are sometimes stacked up on the print queue and inadvertantly printed by a different user.  After a user clears the print spooler with a batch file (an application menu points to a .bat - code is below), if the printer's window is open, that window doesn't automatically refresh.  This means that it is showing print jobs that no longer exist (and confuses users who thinks that the clearing of the queue did not work)  I'd like to be able to either automatically refresh or close the printer's window as part of the bat script.   When doing this manually in task manager it shows the printer window as an "application" that can be manually closed from the application tab, but if you find the process it points to explorer.exe.  I've tried killtask on explorer, but this is a bit extreme and requires logging in again.  Regarding the refresh, when done manually it is via the View menu.  Suggestions?
REM To clear the print spooler in XP
Net Stop Spooler
cd c:\Windows\System32\Spool\Printers\
del *.* /q
Net Start Spooler

Open in new window

Comment
Watch Question
Top Expert 2009
Commented:
This problem has been solved!
Unlock 2 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE