I' m trying to write a batch file that close an open folder, for example pippo. I've tryed:
net file pippo /close
and:
net file C:/pippo / close
but they didn' t work.
Any ideas ?
I' m trying to write a batch file that close an open folder, for example pippo. I've tryed:
net file pippo /close
and:
net file C:/pippo / close
but they didn' t work.
Any ideas ?
solution for < 8 :
TASKKILL /F /FI "WINDOWTITLE eq %DirectoryPath%" /IM explorer.exe
For windows 8(.1)/10
TASKKILL /F /FI "WINDOWTITLE eq %DirectoryName%" /IM explorer.exe
This hybrid code [Batch/Vbscript] try to close all opened folders:
@echo off
Set VBSFILE=%Temp%\CloseAllOpenedFolders.vbs
(
echo Option Explicit
echo Dim shell,oWindows,j
echo Set shell = CreateObject("Shell.Application"^)
echo set oWindows = shell.windows
echo for j = 0 to oWindows.count - 1
echo oWindows.item(j^).quit
echo next
echo set shell = nothing
echo set oWindows = nothing
)>%VBSFILE%
Start /Wait %VBSFILE%
Need to loop from high to low
Option Explicit
Dim shell,oWindows,j
Set shell = CreateObject("Shell.Application")
Set oWindows = shell.windows
for j = oWindows.count - 1 to 0 Step -1
oWindows.item(j).quit
Wscript.Sleep 50
next
set shell = nothing
set oWindows = nothing
Next code should work (but I did not tested it)
md (folder location/path)