473,769 Members | 4,202 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process Kill?

58 New Member
How would you make a program that kills a system process?
Mar 18 '07 #1
12 6787
bartonc
6,596 Recognized Expert Expert
How would you make a program that kills a system process?
Do you know how to do what you want from the command line? If so, please supply an example. If not, you'll need this info first.
Mar 18 '07 #2
shing
58 New Member
i want to be able to process kill explorer.exe (not to be confused with iexplore)

This will allow me to see my background and have any amount of programs on my computer without them being in front of my background { its a secret ;) }

Please help me, Bartonc
Mar 18 '07 #3
ghostdog74
511 Recognized Expert Contributor
if you know the pid, you can use kill(), check this os process management
Mar 18 '07 #4
bartonc
6,596 Recognized Expert Expert
i want to be able to process kill explorer.exe (not to be confused with iexplore)

This will allow me to see my background and have any amount of programs on my computer without them being in front of my background { its a secret ;) }

Please help me, Bartonc
I don't recommend what you are talking about. Explorer is listed as "important for the stable running of you operating system". That said:
Expand|Select|Wrap|Line Numbers
  1. import os
  2. os.system("taskkill  /im explorer.exe")
might just do it.

system( command)

Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations. Changes to posix.environ, sys.stdin, etc. are not reflected in the environment of the executed command.

On Windows, the return value is that returned by the system shell after running command, given by the Windows environment variable COMSPEC: on command.com systems (Windows 95, 98 and ME) this is always 0; on cmd.exe systems (Windows NT, 2000 and XP) this is the exit status of the command run; on systems using a non-native shell, consult your shell documentation.
Mar 18 '07 #5
shing
58 New Member
Can your posts please be put into more comphrensible terms? I'm only 16...

Not to mention I just started Python...
Mar 18 '07 #6
bartonc
6,596 Recognized Expert Expert
Can your posts please be put into more comphrensible terms? I'm only 16...

Not to mention I just started Python...
I ran a test. This works to kill a process that you know the name of (in this case "notepad.ex e").

>>> import os
>>> os.system("task kill /im notepad.exe")
0
>>>
os is a standard library module. You can look it up in Start->Programs->Python 2.x-> Python Manuals. Click on the Global Module Index link. Scroll down to os and hit that link. You need to be able to find stuff in the manual and understand what is in there. That way when you see and example, you can look up the part that you don't understand.
Mar 18 '07 #7
shing
58 New Member
1. Why does it return a "0"? I tried it on other programs, and, when it fails it returns a "128".

2. What does "/im" do?
Mar 18 '07 #8
bartonc
6,596 Recognized Expert Expert
1. Why does it return a "0"? I tried it on other programs, and, when it fails it returns a "128".
0 means "no error"
2. What does "/im" do?
Start->Help and Support: Search taskkill:

TaskkillEnds one or more tasks or processes. Processes can be killed by process ID or image name.

Syntax
taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t]

Parameters
/s Computer
Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u Domain\User
Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.
/p Password
Specifies the password of the user account that is specified in the /u parameter.
/fi FilterName
Specifies the types of process(es) to include in or exclude from termination. The following are valid filter names, operators, and values.
Mar 18 '07 #9
shing
58 New Member
i dont understand how "IM" stands for TASK KILL....shouldn t it be TK?wait hang on...i saw a line....so um...IM stands for imageName? how strange....anyw ays.....does imagename just mean the filename?
Mar 19 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

21
13084
by: John Lin | last post by:
Howdy, I want to know how to tell if a forked process is done. Actually, my real question is that I want to run a shell script inside of a python script, and after the shell script has finished running, I want to do more stuff *condition* on the fact that the shell script has finished running, inside the same python script. The only way I can think of is to fork a process and then call the
3
6388
by: pattanawadee | last post by:
Deall All, Could anybody suggestion me How to kill all inherrit processes (sibling child,previous and parent process) in the case I know only child process id and user id, For example I strart to trace pid 124 of user A (uid = 100) and then I noticed that he doing something wrong so, I get process id now process id is 156 (supposed) then I want to kill all inherrit processes of user A (now I know only this process is 156 and uid is 100)...
1
2785
by: Mullin Yu | last post by:
But, I want is that I can have a Main app that will start a new process or kill one particular or all process. The process will open a console exe. But, I don't want the user to close the console windows by themselves, and force them to use the Main app. If I use Windows Services, I'm not sure can I create one dynamically, and then kill easily. But, if using console application, my following coding is working now. using System;
2
9654
by: Hayato Iriumi | last post by:
Hello, I have a need to kill a process. It sounds each enough, but the problem is that I have multiple executables running from different paths. Say, I have MyService.exe running from C:\FolderA and the same MyService.exe running in C:\FolderB. I want to kill the process that is running under C:\FolderA. So I guess I have a need to get the Process ID for the executable under C:\FolderA. How can I kill the process when you know the...
6
2185
by: gizmo | last post by:
I have a requirement to initiate more than one instance of an application using the filenames. (the example below will start two instances of MS Word). My problem is that I need to kill each instance individually, but this does not appear possible using the Process object. When I run the example below the process object "p" can be viewed using Quick Watch however process object p2 is displayed as undefined, with the added affect of not...
0
2190
by: WATYF | last post by:
This is my problem... I have some code that starts a Process and returns it to a variable... (prcBat) At any time while that process is running... I want to be able to Kill it by pressing a command button in the application. So the code goes something like this: psiBat = New ProcessStartInfo(arrRun.Item(0)(1)) psiBat.WindowStyle = ProcessWindowStyle.Hidden
5
4598
by: Dino Buljubasic | last post by:
My application can allow a user to open a file for viewing by fetching file data from database, creating the file in a temp directory and starting appropriate process (i.e. Adobe or any other depending of file type) to open the file. when I close my application, it is suppose to clean all files it created in temp directory. I do this by : for each file in temp
8
4742
by: Rain | last post by:
Does anyone know how i can kill a process using C#? im developing an asp.net web application using C# and the asp.net process doesnt die even if the application has already exited. So i need to kill the process someone.. does anyone know the code for this? thank you so much in advance!!!!
9
16149
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
4
20781
by: Richard Rossel | last post by:
Hi Fellows, I have a problem with process termination. I have a python code that apache runs through a django interface. The code is very simple, first, it creates a process with the subprocess.Popen call, and afterwards, (using a web request) the python code uses the PID of the previously created process(stored in a db) and kills it with an os.kill call using the SIGKILL signal. The creation of the process is ok, apache calls the...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.