Page 1 of 1

closing a window

Posted: 19 Feb 2012 20:15
by storm97
can you make it close an open window, im trying to make a file to run through my music and the windows start to stack up...
thanks

Re: closing a window

Posted: 20 Feb 2012 01:21
by foxidrive
If you show us your batch file your task may become clearer.

It can depend on which music player you are using...

Re: closing a window

Posted: 20 Feb 2012 08:19
by Mister Fox
The command you are looking for is taskkill. It will close the window.

taskkill /f /im notepad.exe

Replace notepad.exe with whatever you want to close.

You don't have to specify the location becuase taskkill looks in your porcesses, where everything is just a .exe file


I hope this helps!

Re: closing a window

Posted: 20 Feb 2012 08:23
by foxidrive
Is taskkill in all versions of Win 7 and Vista?
FWIW I don't think XP Home has taskkill.

Killing the window is one way, and you can download PSkill from sysinternals - but using the switches/configuration in the media player to close it after playing is the preferred method. That's why I asked which media player is being used.

Re: closing a window

Posted: 20 Feb 2012 08:33
by Mister Fox
taskkill is present in all versions of windows 7 and Vista, and also in Windows XP Professional.

taskkill alone might not work on the media player (like what you were saying)

thats why I reccomended taskkill /f

taskkill /f terminated the process (kinda like a fast End Task)

I thought it might work.