closing a window

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
storm97
Posts: 7
Joined: 13 Feb 2012 17:33

closing a window

#1 Post by storm97 » 19 Feb 2012 20:15

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

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: closing a window

#2 Post by foxidrive » 20 Feb 2012 01:21

If you show us your batch file your task may become clearer.

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

Mister Fox
Posts: 7
Joined: 20 Feb 2012 08:14
Location: Behind you
Contact:

Re: closing a window

#3 Post by Mister Fox » 20 Feb 2012 08:19

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!

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: closing a window

#4 Post by foxidrive » 20 Feb 2012 08:23

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.

Mister Fox
Posts: 7
Joined: 20 Feb 2012 08:14
Location: Behind you
Contact:

Re: closing a window

#5 Post by Mister Fox » 20 Feb 2012 08:33

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.

Post Reply