Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

how to close a folder through cmd/bat?

- - - - -

  • Please log in to reply
3 replies to this topic

#1
laz3boy

laz3boy

    Newbie

  • Members
  • 13 posts
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, 27 September 2009 - 05:20 AM.



How to remove advertisement from MSFN

#2
Geej

Geej

    Senior Member

  • Members
  • PipPipPipPip
  • 635 posts
  • OS:XP Pro x86
  • Country: Country Flag
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"

#3
laz3boy

laz3boy

    Newbie

  • Members
  • 13 posts
Wow!, this gets the job done man!!, thanx a lot ~~!!
Its a nice little utility and it helps in many other stuff
thanks again.

#4
tazosmr

tazosmr
  • Members
  • 3 posts
(CHANGE "YourWindowTITLEEE" and "yourFileName.vbs" to whatever you want. Below is just an example:)

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\yourFileName.vbs //NoLogo"

Edited by tazosmr, 17 May 2013 - 09:56 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN