• Announcements

    • xper

      MSFN Sponsorship and AdBlockers!   07/10/2016

      Dear members, MSFN is made available via subscriptions, donations and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, become a site sponsor and ads will be disabled automatically and by subscribing you get other sponsor benefits.
Sign in to follow this  
Followers 0
laz3boy

how to close a folder through cmd/bat?

7 posts in this topic

Let's say I have a folder in drive C: named X

I can open that folder from a cmd window with the command start C:\X

but what If I want to close the same opened folder through cmd or a bat ,

How can I do it??

thanx in advance..

Edited by laz3boy
0

Share this post


Link to post
Share on other sites

Try NirCmd.exe. Read the help file.

To close all opened explorer folders, syntax : nircmd.exe win close class "CabinetWClass"

To close only a particular folder, say My Picture folder ( I have My Pictures & My Music folders open), syntax: nircmd.exe win close title "My Pictures"

0

Share this post


Link to post
Share on other sites

Wow!, this gets the job done man!!, thanx a lot ~~!!

Its a nice little utility and it helps in many other stuff

thanks again.

0

Share this post


Link to post
Share on other sites

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") ThenWScript.Sleep 100oShell.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

Edited by tazosmr
0

Share this post


Link to post
Share on other sites

Metod1

Metod2

 

Don't work

 

Something Else maybe.

 

Can't  close folder Libraries in win7

0

Share this post


Link to post
Share on other sites

Metod1

Metod2

 

Don't work

 

Something Else maybe.

 

Can't  close folder Libraries in win7

Which "Title" are you using for it?

DId you try the nircmd.exe?

 

jaclaz

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.