# [BAT FILE] Using BAT To Exit a Process From Task Manager's Process



## DigitalAbsence (Mar 29, 2009)

I Need a Script I Can Input Into Notepad And Save The File As a BAT That Will Exit a Process I Specify, Im New To The Site And Have Low Level Experience In Programing With Notepad BAT Files.
Thanks, -Digital.


----------



## TheOutcaste (Aug 8, 2007)

Welcome to TSG!

Helps to know what OS you are going to use this in. WinXP and later have the *Taskkill* command. NT4 and Win2K can use the *kill.exe* utility from the NT4 Resource kit, or *pskill* from Sysinternals.

How will you specify the process, by Name or by PID?

*taskkill /IM Notepad.exe* will kill notepad
add */F* to force it to close, and add */T* to terminate child processes.

Type *taskkill /?* in a Command Prompt for all the options.

HTH

Jerry


----------



## DigitalAbsence (Mar 29, 2009)

Well I want it to run in windows XP, Basically Im Trying To Create a NON-Harmful Fun Virus Using a BAT file, It Would Kill The "Explorer.ExE" Process. When You End Explorer.ExE It Closes The UI (Start Menu And Bottom Task Bar). Just a Prank For My Friend.


----------



## Squashman (Apr 4, 2003)




----------



## TheOutcaste (Aug 8, 2007)

Should've remembered that April 1st is coming up.

Something to think about is that if your friend doesn't know how to use the Task Manager to restart explorer, or to shut down the system, they may just "pull the plug".

Anytime you power off a system rather than shutting it down, there is always a chance of file corruption, which can cause data loss, or even an unbootable system. Especially if your friend tries to boot several times.

If this runs at startup, keep in mind that there are numerous system services and other programs all starting at the same time. Meaning the system is reading from both the System and Software registry hives quite heavily at this point. Corrupt one of those hives, and you could end up with one of these messages:

* Windows XP could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM
Windows XP could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SOFTWARE*

Repairing either of these errors, while not too difficult for an experienced tech, would not be considered an easy fix.

So your "NON-Harmful Fun Virus" could end up being anything but.

And if this is a company owned computer; well, I've worked for places where a prank like this would be cause for immediate termination.

Jerry


----------



## DigitalAbsence (Mar 29, 2009)

Ill be with him when the file is used.
I will fix it for him.


----------

