There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot bsod computer connection crash css dell drive driver drivers email error ethernet excel explorer firefox firefox 3 freeze game hard drive internet internet explorer itunes laptop malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems ram router slow sound sprtcmd.exe trojan usb virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Killing a process on system startup


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
matthewcheck's Avatar
Junior Member with 5 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 02:40 AM #1
Killing a process on system startup
Hi all,

I am trying to write a batch file on Win XP which kills a process after the system boots up. I have tried it with simple file batch file like:

Code:
@echo off
taskkill /F /IM process.exe
and i added the new registry entry in

Code:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
to run the batch file on system startup. It is all OK with that, but the problem is that at the time of the system startup the process may or may not be running. I just want to make sure that the process is killed after all. I have thought about doing it with some kind of sleep in the batch file, but at the end i've found out that it's not the best way to do it, since the process may be started up after this time period and this should be as quick as possible and i need to be sure that the process get killed. Any help with this??

Thx in advance
JimmySeal's Avatar
Computer Specs
Junior Member with 10 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 09:06 AM #2
This may be a dumb question, but why don't you just stop the process from starting in the first place?
matthewcheck's Avatar
Junior Member with 5 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 09:30 AM #3
Quote:
Originally Posted by JimmySeal
This may be a dumb question, but why don't you just stop the process from starting in the first place?
Well, I have not thought about that option, but how i am able to stop it? The process is started automatically on system startup by the remote process which is common for all of the computers in the domain, so I believe that I do not have the possibility to prevent the process from being started ... Or am I wrong??
Noyb's Avatar
Computer Specs
Distinguished Member with 8,454 posts.
 
Join Date: May 2005
Location: Kokomo
Experience: More Input Please
26-Sep-2007, 09:38 AM #4
RUN > msconfig .... and shut down the ones you don't want ...
Attached Thumbnails
killing-process-system-startup-clipboard00.gif  killing-process-system-startup-clipboard01.gif  
matthewcheck's Avatar
Junior Member with 5 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 09:48 AM #5
Well, the reason why i am trying to kill this process after the system startup is that it is started by another process, which i cannot stop or prevent to start. So it looks like the only way to prevent the process from running is to kill it everytime when the system starts up. And that is why i am trying to write a batch file, so i don't have to kill the process manually ...
JohnWill's Avatar
Computer Specs
Moderator with 78,896 posts.
 
Join Date: Oct 2002
Location: South Eastern PA, USA
Experience: Advanced age & experience
26-Sep-2007, 10:05 AM #6
JimmySeal's Avatar
Computer Specs
Junior Member with 10 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 10:08 AM #7
Hadn't considered it might be starting from somewhere else on the network.

What if you have the batch file loop and go to sleep for short intervals on every iteration until the process is found and killed?
taskkill returns ERRORLEVEL 0 on successfull process termination and nonzero (it appears to be 128) if the process is not found.

Last edited by JimmySeal : 26-Sep-2007 10:36 AM.
matthewcheck's Avatar
Junior Member with 5 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 12:56 PM #8
Quote:
Originally Posted by JohnWill
Thanks for your reply, one question, isn't this pskill tool something similar to the one included with Win XP named "taskkill"? Does it provide more options than the taskkill?
matthewcheck's Avatar
Junior Member with 5 posts.
 
Join Date: Sep 2007
Experience: Advanced
26-Sep-2007, 01:04 PM #9
Quote:
Originally Posted by JimmySeal
Hadn't considered it might be starting from somewhere else on the network.

What if you have the batch file loop and go to sleep for short intervals on every iteration until the process is found and killed?
taskkill returns ERRORLEVEL 0 on successfull process termination and nonzero (it appears to be 128) if the process is not found.
Hmmm, I have thought about that option, but isn't there more sophisticated solution? What if for example the process didn't get started and the batch will end up in infinite loop? I know, it is really difficult to solve this at first look very simple problem, but there are so much things to think about ... Maybe i will do the for loop with for example 20 loops, and if the process doesn't get started after all, i will exit the loop and continue normally ... Or does anyone have some other solution?
JohnWill's Avatar
Computer Specs
Moderator with 78,896 posts.
 
Join Date: Oct 2002
Location: South Eastern PA, USA
Experience: Advanced age & experience
26-Sep-2007, 02:42 PM #10
Regarding PsKill, I figured you might want to try another one, since I presume you've already tried the XP version.
Squashman's Avatar
Distinguished Member with 12,698 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
27-Sep-2007, 11:51 AM #11
And Microsoft must have had some reason for buying Sysinternals. Maybe there commnad line tools were inferior to theres. I for one do think PStools are much better options then many of the Builtin utilites of XP.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:25 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.