Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: How do I Close an opened folder in Run or at the Command prompt

16 Nov 2011   #1

Windows 7 x64 Home
How do I Close an opened folder in Run or at the Command prompt

I have an application that opens a folder using a shell to Explorer. I can close Most apps I shell using Taskkill but not the opened folder. I have tried Openfiles with no luck ( I think it is for networks). I need this to tidy up an application.

Thank you.

My System SpecsSystem Spec

16 Nov 2011   #2

Microsoft Community Contributor Award Recipient

Windows 7 x64

I believe you may find your solution here it would seem to work on open folders to an extent.

Close an Open File
My System SpecsSystem Spec
16 Nov 2011   #3

Windows 7 x64 Home

Sorry I think this is for shared file and folders. I type net file and nothing is listed. The file requires a special ID.
My System SpecsSystem Spec

17 Nov 2011   #4

Windows 7 x64 Home

Still no luck. I have had three ideas on how to close this folder. I need help with finding out if they are possible.
1. The folder was opened using Explorer. Explorer "Folder Path". Maybe Explorer has other Command line options to close?

2. The Folder can be closed using Task Manager. Maybe taskmgr.exe has command line options.

3. The Folder can close itself with Ctrl|W. Is there a way of issuing those keystrokes without typing. I think the Folder will be in focus.

I appreciate any help. Thank You.
My System SpecsSystem Spec
11 Jul 2014   #5


I know, that topic is old, but problem is actual, so SOLUTION was here -

method 1 :

With CMD(command prompt):
TASKKILL /F /FI "WINDOWTITLE eq MYTITLEEEEEEEEEEEEEE" /IM explorer.exe (just change MYTITLEEEEEEEEEEEEEE with the opened folder's title [case-sensitive])

method 2 :
open a new text document and enter this code:

Set oShell = CreateObject("WScript.Shell") If oShell.AppActivate("YourWindowTITLEEEEEEEEEEEEE") Then WScript.Sleep 100 oShell.SendKeys "%{F4}" End If
then save that file as yourfile.vbs and put to your desired path.
Then run the Command:
%windir%\system32\cmd.exe /C "START /WAIT CScript C:\ExampleFolder\yourfile.vbs //NoLogo"

(note,that you should change "YourWindowTITLEEE" and "yourFileName.vbs" to whatever you want. Below is just an

My System SpecsSystem Spec

 How do I Close an opened folder in Run or at the Command prompt

Thread Tools

Similar help and support threads for2: How do I Close an opened folder in Run or at the Command prompt
Thread Forum
Folder - Delete from Command Prompt Tutorials
Help needed executing command prompt command General Discussion
Solved double clicking a folder opens a command prompt General Discussion
Run administrative command prompt from command prompt General Discussion
Windows 7 SP1 Can Crash If Command Prompt Is Opened and Closed Windows Updates & Activation
Command Prompt command <ipconfig> not working Network & Sharing
File and Folder - Rename from Command Prompt Tutorials

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:49 AM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33