Advertisement
absolutereality

Restart Explorer & Restore Open Windows

Jan 17th, 2022
864
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. title restart explorer & restore open windows
  3. setlocal enabledelayedexpansion
  4.  
  5. powershell  @^(^(New-Object -com shell.application^).Windows^(^)^).Document.Folder.Self.Path >> prevfolderpaths.txt
  6.  
  7. taskkill /im explorer.exe /f
  8.  
  9. start explorer.exe
  10.  
  11. FOR /F "tokens=*" %%f IN (prevfolderpaths.txt) DO (
  12.  
  13. set "var=%%f"
  14. set "firstletters=!var:~0,2!"
  15.  
  16. IF "!firstletters!" == "::" ( start /min shell:%%~f ) ELSE ( start /min "" "%%~f" )
  17.  
  18. )
  19.  
  20. del "prevfolderpaths.txt"
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement