Saturday, January 22, 2011

Batch File To Restart Explorer And Reopen Windows

Though this is not a very common task, I suppose this example of batch scripting is still very useful for advanced users of batch files. You can change anything you want in a couple of minutes, especially with help of our powerful and handy batch files editor.
Here is the code to restart Windows Explorer and reopen all windows of the running applications:
@echo off setlocal enabledelayedexpansion for /f "usebackq tokens=8*" %%a in (`"cmdow /t /f | find /i "explorer""`) do ( if /i "%%a"=="explorer" set "open_windows=!open_windows! "%%b"" ) taskkill /f /im explorer.exe>nul start explorer for %%a in (%open_windows%) do ( if /i %%a=="My Computer" (start /min explorer shell:DriveFolder) else ( start /min explorer %%a) )
Hope you'll find this code useful.

No comments:

Post a Comment

Translate