Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

A batch file to kill a process

Original Message
Name: Stella Yang
Date: June 17, 2005 at 07:44:26 Pacific
Subject: A batch file to kill a process
OS: windows XP
CPU/Ram: 2.0 GHz and 512 MB
Comment:
I am trying to create a batch file to kill a process only if it is running. I found a pskill tool from windows xp tool site but when I put it in the batch file and scheduled the task, a black window always flash to kill the process no matter if it is running or not. My question is:
1. How do I put it in the batch to run this pskill by detecting if it alive first.
Or--2. How do I get this scheduled task run minimized or another secretive way? I don't want to see the black window popping up.
Thanks a lot if you could help me! Note: I can make the batch file run minimized from its property setting but when it is in scheduled task, I couldn't get it to minimize anymore.


Report Offensive Message For Removal


Response Number 1
Name: Dr. Nick
Date: June 17, 2005 at 11:25:42 Pacific
Subject: A batch file to kill a process
Reply: (edit)
How are you trying to kill the task? I've used pskill before, and while it's nice, you could just use the built-in program, TASKKILL.

Just run it like this to use the program name:

TASKKILL /F /IM "notepad.exe"

Or this to kill it based on the process ID:

TASKKILL /F /PID 1234

Does that work?


Report Offensive Follow Up For Removal

Response Number 2
Name: Stella Yang
Date: June 17, 2005 at 11:47:49 Pacific
Subject: A batch file to kill a process
Reply: (edit)
Dr. Nick,
Thanks! I simply not aware of that command. But pskill command does the same -- pskill notepad.exe.

I still have the same problem with taskkill when it is in scheduled task with a black window popping up to kill the process even if the process is not running. Anyway to avoid that? Are you aware of any DOS command to run conditioned command? Like "if EXIST (processname). (taskkill processname)"....


Report Offensive Follow Up For Removal

Response Number 3
Name: Dr. Nick
Date: June 17, 2005 at 13:21:04 Pacific
Subject: A batch file to kill a process
Reply: (edit)
Are you just trying to prevent the black box from poping up? If this is the case then even if you got the If statement to work you'd still see the black box.

I'm not sure if there's a way to run that command without seeing the command window. The box only pops up for a second, why is that a problem?


Report Offensive Follow Up For Removal

Response Number 4
Name: jackpot18901
Date: January 4, 2006 at 10:28:11 Pacific
Subject: A batch file to kill a process
Reply: (edit)
You can use the TASKKILL command with the /FI switch that has an operator of e and a value of RUNNNING
It might look something like this:
TASKKILL /F /IM notepad.exe /FI STATUS ne RUNNING

Type the TASKKILL /? to see all the possible filers,operators and values.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: A batch file to kill a process

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




CPU and Graphics Upgrade Questions

VIRUS ALERT in Taskbar, HELP!

DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC