> I found a suggestion to do this:
> start /min N:\
> timeout 2 /nobreak
> taskkill /im explorer.exe /fi "WINDOWTITLE eq N:\\"
>
> But the titles of my explorer windows aren't that simple. They include
> the share name too. And even if I include them in teh command, it keeps
> saying "INFO: No tasks running with the specified criteria."
>
> I tried "tasklist /fi "imagename eq explorer.exe" /v" but it lists
> the window title as N/A.
If you do this in Explorer first, it works:
- click on View then Options then Change Folder and Search Options
- click on the View tab
- Enable Display the full path in the title bar
- Enable Launch folder windows in a separate process
But oddly, "tasklist /fi "imagename eq explorer.exe" /v" now only lists two tasks, no matter how many Explorer windows are open. It shows the main one, and the most recently opened one. Which is fine, as the latter is the one to be killed.
Looks like you don't really have to enable "Display the full path in the title bar". You could still kill it with:
taskkill /im explorer.exe /fi "WINDOWTITLE ne xyz"
Sounds like a lot of bother though.