Delete Directory Even If Program Is Running?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
limitdos
Posts: 3
Joined: 20 Jan 2010 13:34

Delete Directory Even If Program Is Running?

#1 Post by limitdos » 20 Jan 2010 13:38

I have alot of students that install toolbars...including the google toolbar.
I use rd to delete the directory of the toolbar, is there a way to delete a directory, even if a program is running inside it?

I try to delete the GoogleToolbarNotifier directory, but it has a program that runs when the computers startup, so rd will not delete it.

i'm using:
rd /s "C:\Program Files\Google\GoogleToolbarNotifier" /q


My fundamental problem is I have computers that are slowed down because there are so many toolbars installed on some of the computers.

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

#2 Post by alan_b » 20 Jan 2010 14:55

Windows will not allow you to delete a folder while a process is running within it. First you have to kill the process.

Windows Task Manager / Applications will allow you to select and "End Task".
You may then need "Processes" Tab in case the exe is still alive, in which case "End Process" - or in extreme conditions right click the process and choose "End Process Tree".

Alan

limitdos
Posts: 3
Joined: 20 Jan 2010 13:34

#3 Post by limitdos » 20 Jan 2010 21:26

alan_b wrote:Windows will not allow you to delete a folder while a process is running within it. First you have to kill the process.

Windows Task Manager / Applications will allow you to select and "End Task".
You may then need "Processes" Tab in case the exe is still alive, in which case "End Process" - or in extreme conditions right click the process and choose "End Process Tree".

Alan


How do I get a batch file to do that?

I don't want to walk around to each computer log them off and log back on just to end a google toolbar notifier program and then delete it and then log them back on....

the students don't have access to the task list....only i do...thats the way the IT guy set it up at my school.

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

#4 Post by alan_b » 21 Jan 2010 02:09

See http://commandwindows.com/taskkill.htm

Availability depends on whether you use XP Home or XP Professional.
If you use a different system you can Google for equivalents, or wait for some-one else to advise.

Just be careful what you kill ! ! !

Alan

limitdos
Posts: 3
Joined: 20 Jan 2010 13:34

#5 Post by limitdos » 21 Jan 2010 08:34

alan_b wrote:See http://commandwindows.com/taskkill.htm

Availability depends on whether you use XP Home or XP Professional.
If you use a different system you can Google for equivalents, or wait for some-one else to advise.

Just be careful what you kill ! ! !

Alan


thank you guys for the info....

I have XP Professional on all my computers...looks like I'll try task kill

edit:
I noticed it hangs for a good while to task kill the program....

is there anyway to say IF googletoolbarnotifier.exe is running end it?

that way it will only try to end it if its running.

Post Reply