This web page requires JavaScript to be enabled.

JavaScript is an object-oriented computer programming language commonly used to create interactive effects within web browsers.

How to enable JavaScript?

bashscript – Restart explorer without losing open windows

Blog, Snippets December 21, 2022 0

When we have to restart explorer.exe, usually we have many folders opened, which get closed in the process. There is a way to re-open these folders automatically after restarting explorer using bat script:

@echo off
setlocal enabledelayedexpansion
powershell  @^(^(New-Object -com shell.application^).Windows^(^)^).Document.Folder.Self.Path >> openedpaths.txt
taskkill /im explorer.exe /f
start explorer.exe
FOR /F "tokens=*" %%f IN (%~dp0openedpaths.txt) DO (
    set "var=%%f"
    set "firstletters=!var:~0,2!"
    IF "!firstletters!" == "::" ( start /min shell:%%~f ) ELSE ( start /min "" "%%~f" )
del "%~dp0openedpaths.txt"

Save script above with .bat extension and it ready to work.


Nam Le

Nam Le

0 responds

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.