If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Is there a stop command?
Is there a command that can be used, say in a batch file, that stops a
running command (or command tree)? I mean, if I see in Task Manager that xyz.exe and abc.exe are running, is there something that I could use, such as stop abc.exe stop xyz.exe that would do the same - if run in a batch file - as stopping them using Task Manager's facilities would? [I tried "stop", and it doesn't exist (-:] If there is, would it need to know their full path? (And yes, I know killing processes is often not advisable.) -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf Old soldiers never die - only young ones |
Ads |
#2
|
|||
|
|||
Is there a stop command?
From: "J. P. Gilliver (John)"
Is there a command that can be used, say in a batch file, that stops a running command (or command tree)? I mean, if I see in Task Manager that xyz.exe and abc.exe are running, is there something that I could use, such as stop abc.exe stop xyz.exe that would do the same - if run in a batch file - as stopping them using Task Manager's facilities would? [I tried "stop", and it doesn't exist (-:] If there is, would it need to know their full path? (And yes, I know killing processes is often not advisable.) Microsoft (R) Windows NT (TM) Version 3.5 KILL Copyright (C) 1994-1998 Microsoft Corp. All rights reserved usage: KILL [options] pid | pattern* [options]: -f Force process kill pid This is the process id for the task to be killed. Use TLIST to get a valid pid pattern The pattern can be a complete task name or a regular expression pattern to use as a match. Kill matches the supplied pattern against the task names and the window titles. ----------- TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F] Description: This tool is used to terminate tasks by process id (PID) or image name. Parameter List: /S system Specifies the remote system to connect to. /U [domain\]user Specifies the user context under which the command should execute. /P [password] Specifies the password for the given user context. Prompts for input if omitted. /FI filter Applies a filter to select a set of tasks. Allows "*" to be used. ex. imagename eq acme* /PID processid Specifies the PID of the process to be terminated. Use TaskList to get the PID. /IM imagename Specifies the image name of the process to be terminated. Wildcard '*' can be used to specify all tasks or image names. /T Terminates the specified process and any child processes which were started by it. /F Specifies to forcefully terminate the process(es). /? Displays this help message. Filters: Filter Name Valid Operators Valid Value(s) ----------- --------------- ------------------------- STATUS eq, ne RUNNING | NOT RESPONDING | UNKNOWN IMAGENAME eq, ne Image name PID eq, ne, gt, lt, ge, le PID value SESSION eq, ne, gt, lt, ge, le Session number. CPUTIME eq, ne, gt, lt, ge, le CPU time in the format of hh:mm:ss. hh - hours, mm - minutes, ss - seconds MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB USERNAME eq, ne User name in [domain\]user format MODULES eq, ne DLL name SERVICES eq, ne Service name WINDOWTITLE eq, ne Window title NOTE ---- 1) Wildcard '*' for /IM switch is accepted only when a filter is applied. 2) Termination of remote processes will always be done forcefully (/F). 3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote machine is specified. Examples: TASKKILL /IM notepad.exe TASKKILL /PID 1230 /PID 1241 /PID 1253 /T TASKKILL /F /IM cmd.exe /T TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*" TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM * TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*" -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp |
#3
|
|||
|
|||
Is there a stop command?
In message , David H.
Lipman writes: From: "J. P. Gilliver (John)" Is there a command that can be used, say in a batch file, that stops a running command (or command tree)? [] (And yes, I know killing processes is often not advisable.) Microsoft (R) Windows NT (TM) Version 3.5 KILL Copyright (C) 1994-1998 Microsoft Corp. All rights reserved usage: KILL [options] pid | pattern* [options]: -f Force process kill What does the -f option do - or rather, what does omitting it do? (I'm guessing that without it it's like using an application's close button if it's got one, but with -f it's more like killing it from Task Manager, i. e. more likely to close at the cost of more likely data loss - is that right?) pid This is the process id for the task to be killed. Use TLIST to get a valid pid Which I probably wouldn't know if I was writing a batch file, unless the same process always gets the same PID. pattern The pattern can be a complete task name or a regular expression pattern to use as a match. Kill matches the supplied pattern against the task names and the window titles. So "kill xyz.exe" would probably kill process xyz.exe? (Would it need the ".exe"?) [] (Rest - including TASKKILL - kept for reference; thanks. Mostly way over my head!) -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf Charity sees the need not the cause. -German proverb |
#4
|
|||
|
|||
Is there a stop command?
J. P. Gilliver (John) wrote:
So "kill xyz.exe" would probably kill process xyz.exe? (Would it need the ".exe"?) [] (Rest - including TASKKILL - kept for reference; thanks. Mostly way over my head!) I like this one. I think that kills *all* the notepads. Use a PID (process ID number) instead, if you want a "precision" kill. TASKKILL /IM notepad.exe Open a Command Prompt window and test it out. Start a couple of Notepads, and verify it got both of them. ******* What a command like Taskkill cannot stop effectively, is a fork bomb. I've never tested fork bombs on Windows, and only had to stop a couple on Unix (no, not my own). On Linux/Unix, they have kill() and killpg(), and killpg is the one I look to, to stop a fork bomb. They have the notion of process groups and process group IDs (PGID). If you can find the parent of the thing that has gone nuts, killing it with killpg() kills all the forked children as well. I don't know if Windows has any program that implements the same idea or not, as I don't think Windows has process groups. http://en.wikipedia.org/wiki/Fork_bomb http://linux.die.net/man/2/killpg It's great fun trying to stop runaway computers. The last one that got the best of me, was Windows 8, when the Task Manager stopped responding, and I couldn't do anything other than hit the power button. By comparison, Task Manager on WinXP is pretty damn good (it works when you need it the most). Not so on Windows 8. Paul |
#5
|
|||
|
|||
Is there a stop command?
From: "Paul"
J. P. Gilliver (John) wrote: So "kill xyz.exe" would probably kill process xyz.exe? (Would it need the ".exe"?) [] (Rest - including TASKKILL - kept for reference; thanks. Mostly way over my head!) I like this one. I think that kills *all* the notepads. Use a PID (process ID number) instead, if you want a "precision" kill. TASKKILL /IM notepad.exe Open a Command Prompt window and test it out. Start a couple of Notepads, and verify it got both of them. ******* What a command like Taskkill cannot stop effectively, is a fork bomb. I've never tested fork bombs on Windows, and only had to stop a couple on Unix (no, not my own). On Linux/Unix, they have kill() and killpg(), and killpg is the one I look to, to stop a fork bomb. They have the notion of process groups and process group IDs (PGID). If you can find the parent of the thing that has gone nuts, killing it with killpg() kills all the forked children as well. I don't know if Windows has any program that implements the same idea or not, as I don't think Windows has process groups. http://en.wikipedia.org/wiki/Fork_bomb http://linux.die.net/man/2/killpg It's great fun trying to stop runaway computers. The last one that got the best of me, was Windows 8, when the Task Manager stopped responding, and I couldn't do anything other than hit the power button. By comparison, Task Manager on WinXP is pretty damn good (it works when you need it the most). Not so on Windows 8. Paul I just program it in KiXtart as a Function() Easily programmed in VBS as well. If I want to kill IEXPLORE.EXE I call; EndProc("IEXPLORE.EXE") Function EndProc($proc, optional $strComputer) DIM $Process If $strComputer='' $strComputer='.' EndIf For Each $Process In GetObject("winmgmts:{impersonationLevel=impersonat e,(debug)}!\root\cimv2").ExecQuery("Select * from Win32_Process where Name= " +'"'+$Proc+'"') $Process=$Process.Terminate Next EndFunction -- Dave Multi-AV Scanning Tool - http://multi-av.thespykiller.co.uk http://www.pctipp.ch/downloads/dl/35905.asp |
#6
|
|||
|
|||
Is there a stop command?
In message , Paul
writes: [] I like this one. I think that kills *all* the notepads. Use a PID (process ID number) instead, if you want a "precision" kill. TASKKILL /IM notepad.exe Open a Command Prompt window and test it out. Start a couple of Notepads, and verify it got both of them. Sounds just what I need! I tried what you suggested. Unfortunately - both from the "Run" box and a cmd window - "Windows cannot find 'TASKKILL'". (Wording slightly different from the cmd window but same meaning.) Is this because I have XP Home? ******* What a command like Taskkill cannot stop effectively, is a fork bomb. I've never tested fork bombs on Windows, and only had to stop a couple on Unix (no, not my own). I wonder if that's similar to the choice in Task Manager of Kill Process versus Kill Process Tree. (Or similar wording.) [] It's great fun trying to stop runaway computers. (-: I don't _think_ I've had one - not for many years anyway; I do remember certain _websites_ used to pop up windows faster than I could close them, but browsers have probably improved sufficiently that such is no longer a problem. The last one that got the best of me, was Windows 8, when the Task Manager stopped responding, and I couldn't do anything other than hit the power button. By comparison, Task Manager on WinXP is pretty damn good (it works when you need it the most). Not Ah, XP now has the same position in our hearts '9x did: we know its wrinkles, and it "feels" more controllable. so on Windows 8. I think 7 is less responsive in that respect too. Certainly the "going pale" is something I never saw on XP, though that could just be a different (and arguably slightly more visible) way of _showing_ something is unresponsive. Paul -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf A professor is one who talks in someone else's sleep. |
#7
|
|||
|
|||
Is there a stop command?
J. P. Gilliver (John) wrote:
Sounds just what I need! I tried what you suggested. Unfortunately - both from the "Run" box and a cmd window - "Windows cannot find 'TASKKILL'". (Wording slightly different from the cmd window but same meaning.) Is this because I have XP Home? Not a surprise really. If they won't give Home users a "tasklist /svc", why would they give them a "taskkill" ? The mind boggles. Taskkill shows as a separate .exe on my machine, so maybe you can test a "copy" of taskkill.exe from a WinXP Pro machine. C:\WINDOWS\system32\taskkill.exe ******* If I look in "WindowsXP-KB936929-SP3-x86-ENU.exe" SP3 redistributable using 7-ZIP, I see "taskkill.ex_". You can click that one and select "open inside", and the name then changes to taskkill.exe 76,288 bytes. Maybe that one can be coaxed to work for you. My guess is, if you look at the Version info, it'll be 5.1.2600.5512. It's never been patched on my machine, since the SP3 timeframe. Paul |
#8
|
|||
|
|||
Is there a stop command?
In message , Paul
writes: J. P. Gilliver (John) wrote: Sounds just what I need! I tried what you suggested. Unfortunately - both from the "Run" box and a cmd window - "Windows cannot find 'TASKKILL'". (Wording slightly different from the cmd window but same meaning.) Is this because I have XP Home? Not a surprise really. If they won't give Home users a "tasklist /svc", why would they give them a "taskkill" ? The mind boggles. Taskkill shows as a separate .exe on my machine, so maybe you can test a "copy" of taskkill.exe from a WinXP Pro machine. C:\WINDOWS\system32\taskkill.exe ******* If I look in "WindowsXP-KB936929-SP3-x86-ENU.exe" SP3 redistributable using 7-ZIP, I see "taskkill.ex_". You can click that one and select "open inside", and the name then changes to taskkill.exe 76,288 bytes. Maybe that one can be coaxed to work for you. My guess is, if you look at the Version info, it'll be 5.1.2600.5512. It's never been patched on my machine, since the SP3 timeframe. Paul Unfortunately, I have no file whose name contains 936929 under Windows either. -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf She [Helen Mirren] was born Ilyena Lydia Vasilievna Mironov, granddaughter of a Russian aristocrat |
#9
|
|||
|
|||
Is there a stop command?
J. P. Gilliver (John) wrote:
In message , Paul writes: J. P. Gilliver (John) wrote: Sounds just what I need! I tried what you suggested. Unfortunately - both from the "Run" box and a cmd window - "Windows cannot find 'TASKKILL'". (Wording slightly different from the cmd window but same meaning.) Is this because I have XP Home? Not a surprise really. If they won't give Home users a "tasklist /svc", why would they give them a "taskkill" ? The mind boggles. Taskkill shows as a separate .exe on my machine, so maybe you can test a "copy" of taskkill.exe from a WinXP Pro machine. C:\WINDOWS\system32\taskkill.exe ******* If I look in "WindowsXP-KB936929-SP3-x86-ENU.exe" SP3 redistributable using 7-ZIP, I see "taskkill.ex_". You can click that one and select "open inside", and the name then changes to taskkill.exe 76,288 bytes. Maybe that one can be coaxed to work for you. My guess is, if you look at the Version info, it'll be 5.1.2600.5512. It's never been patched on my machine, since the SP3 timeframe. Paul Unfortunately, I have no file whose name contains 936929 under Windows either. Unfortunately, I'm referring to the SP3 redistributable download :-) If you buy a WinXP Gold CD, from eons ago, there are updates like SP1, SP1a, SP2, SP3. These are available as .exe files, suited for possession by an IT person. You install the Service Packs, to bring the system up to date. There are various rules as to whether the updates are installed sequentially or the update is cumulative. The design is "mostly cumulative", with some exceptions. Perhaps you can go from SP1a patch level to SP3, using WindowsXP-KB936929-SP3-x86-ENU.exe . Even though I'm not an IT guy, I keep a set of these files. It allows me to access files for reference purposes, and using 7-ZIP, that's what I'm doing in this case. If I need a file, and I don't trust "Joes download site" to give me a copy, I instead extract it from the .exe I've got. ******* "WindowsXP-KB936929-SP3-x86-ENU.exe" http://www.microsoft.com/en-us/downl...ils.aspx?id=24 For reference, SP2 http://www.microsoft.com/en-us/downl...ils.aspx?id=28 For reference, SP1a (broken download, size info only) xpsp1a_en_x86.exe 125.1 MB 2/3/2003 http://web.archive.org/web/200704152...displaylang=en SP1a is SP1 with Java removed (to settle Java court case). ******* So you can get SP3 and SP2, if you need access to the odd file. Not everything will be in there, and those are not "OS installers". They're for patching an install, with any files that have changed. Those can also save you a tiny amount of Windows Update time, if doing a re-installation, in that using your SP1 installer CD, followed by installing the SP3 .exe, should reduce the remaining Windows Updates to only a hundred plus or so. I have no idea how many it would be if you just let it go ahead on its own. You'd think the logic would be smart enough to install SP3 first, if it was needed. Another way to patch up a system, would be with Wsusoffline, and I have that on a USB stick. I think I've tested that once, and nothing seemed to immediately break. So if you've already loaded all the Microsoft files on a USB stick, that would save download time on a reinstallation. Wsusoffline would have a copy of SP3 316.6MB in it as well. Wsusoffline uses the Microsoft download manifest, and the downloads come from Microsoft itself. This is only practical, if you see yourself repairing a lot of PCs (in a shop). I have mine prepared for a special situation - family member on dialup, not a chance in hell of ever doing enough Windows Update to get patched up to date. So the USB key will be part of my "Care Package" :-) Paul |
#10
|
|||
|
|||
Is there a stop command?
In message , Paul writes:
J. P. Gilliver (John) wrote: In message , Paul writes: [] If I look in "WindowsXP-KB936929-SP3-x86-ENU.exe" SP3 redistributable using 7-ZIP, I see "taskkill.ex_". [] Unfortunately, I have no file whose name contains 936929 under Windows either. Unfortunately, I'm referring to the SP3 redistributable download :-) Ah, sorry - I didn't realise it was the whole of SP3, since it had a KB number! If you buy a WinXP Gold CD, from eons ago, there are updates like SP1, SP1a, SP2, SP3. These are available as .exe files, suited for possession by an IT person. You install the Service Packs, to bring the system up to date. There are various rules as to whether the updates are installed sequentially or the update is cumulative. The design is "mostly cumulative", with some exceptions. Page http://www.microsoft.com/en-us/downl...ils.aspx?id=24 says "Windows XP Service Pack 3 (SP3) includes all previously released updates for the operating system. This update also includes a small number of new functionalities, which do not significantly change customers’ experience with the operating system.", so it looks as if that one _is_ cumulative. Perhaps you can go from SP1a patch level to SP3, using WindowsXP-KB936929-SP3-x86-ENU.exe . Well, the above suggests I could even go from SP0? (Not that I need to; this machine came with SP3. Home, unfortunately.) Even though I'm not an IT guy, I keep a set of these files. Sorry, you can't deny it - you _are_! And I think most of the readers of this newsgroup will back me up on that. What you do for a _living_ is another matter ... (-: It allows me to access files for reference purposes, and using 7-ZIP, that's what I'm doing in this case. If I need a file, and I don't trust "Joes download site" to give me a copy, I instead extract it from the .exe I've got. [] http://www.microsoft.com/en-us/downl...ils.aspx?id=24 Thanks for that. Now got it! For reference, SP2 http://www.microsoft.com/en-us/downl...ils.aspx?id=28 For reference, SP1a (broken download, size info only) xpsp1a_en_x86.exe 125.1 MB 2/3/2003 http://web.archive.org/web/200704152...soft.com/downl oads/details.aspx?familyid=83E4E879-FA3A-48BF-ADE5-023443E29D78&displayl ang=en SP1a is SP1 with Java removed (to settle Java court case). _Are_ those needed in view of what the above says about SP3 being cumulative? [] Another way to patch up a system, would be with Wsusoffline, and I have that on a USB stick. I think I've tested that once, and nothing seemed to immediately break. So if you've already loaded all the Microsoft files on a USB stick, that would save download time on a reinstallation. Wsusoffline would have a copy of SP3 316.6MB in it as well. Wsusoffline uses the Microsoft download manifest, and the downloads come from Microsoft itself. This is only practical, if you see yourself repairing a lot of PCs (in a shop). I have mine Hmm. I _do_ have wsus, though I don't seem to have run it since 2014-9-29. I don't really expect to use it - I'm now using Macrium for backup - but I like to _think_ I could rebuild a(n XP) PC from scratch if I _had_ to. prepared for a special situation - family member on dialup, not a chance in hell of ever doing enough Windows Update to get patched up to date. So the USB key will be part of my "Care Package" :-) Paul Similar, I guess! (Not so much dialup, but limited time I could stay with some of my supportees.) -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf Hadrian's Wall has never been a border between Scotland and England. It lies entirely within England but, when it was built in AD 122 by the Romans as a defence against the raiding Picts, the future English were still in Germany and the Scottish were still in Ireland. - Michael Cullen, Skye, in RT 2014/12/6-12 |
#11
|
|||
|
|||
Is there a stop command?
J. P. Gilliver (John) wrote:
In message , Paul writes: J. P. Gilliver (John) wrote: In message , Paul writes: [] If I look in "WindowsXP-KB936929-SP3-x86-ENU.exe" SP3 redistributable using 7-ZIP, I see "taskkill.ex_". [] Unfortunately, I have no file whose name contains 936929 under Windows either. Unfortunately, I'm referring to the SP3 redistributable download :-) Ah, sorry - I didn't realise it was the whole of SP3, since it had a KB number! If you buy a WinXP Gold CD, from eons ago, there are updates like SP1, SP1a, SP2, SP3. These are available as .exe files, suited for possession by an IT person. You install the Service Packs, to bring the system up to date. There are various rules as to whether the updates are installed sequentially or the update is cumulative. The design is "mostly cumulative", with some exceptions. Page http://www.microsoft.com/en-us/downl...ils.aspx?id=24 says "Windows XP Service Pack 3 (SP3) includes all previously released updates for the operating system. This update also includes a small number of new functionalities, which do not significantly change customers’ experience with the operating system.", so it looks as if that one _is_ cumulative. Perhaps you can go from SP1a patch level to SP3, using WindowsXP-KB936929-SP3-x86-ENU.exe . Well, the above suggests I could even go from SP0? (Not that I need to; this machine came with SP3. Home, unfortunately.) Even though I'm not an IT guy, I keep a set of these files. Sorry, you can't deny it - you _are_! And I think most of the readers of this newsgroup will back me up on that. What you do for a _living_ is another matter ... (-: It allows me to access files for reference purposes, and using 7-ZIP, that's what I'm doing in this case. If I need a file, and I don't trust "Joes download site" to give me a copy, I instead extract it from the .exe I've got. [] http://www.microsoft.com/en-us/downl...ils.aspx?id=24 Thanks for that. Now got it! For reference, SP2 http://www.microsoft.com/en-us/downl...ils.aspx?id=28 For reference, SP1a (broken download, size info only) xpsp1a_en_x86.exe 125.1 MB 2/3/2003 http://web.archive.org/web/200704152...soft.com/downl oads/details.aspx?familyid=83E4E879-FA3A-48BF-ADE5-023443E29D78&displayl ang=en SP1a is SP1 with Java removed (to settle Java court case). _Are_ those needed in view of what the above says about SP3 being cumulative? [] Another way to patch up a system, would be with Wsusoffline, and I have that on a USB stick. I think I've tested that once, and nothing seemed to immediately break. So if you've already loaded all the Microsoft files on a USB stick, that would save download time on a reinstallation. Wsusoffline would have a copy of SP3 316.6MB in it as well. Wsusoffline uses the Microsoft download manifest, and the downloads come from Microsoft itself. This is only practical, if you see yourself repairing a lot of PCs (in a shop). I have mine Hmm. I _do_ have wsus, though I don't seem to have run it since 2014-9-29. I don't really expect to use it - I'm now using Macrium for backup - but I like to _think_ I could rebuild a(n XP) PC from scratch if I _had_ to. prepared for a special situation - family member on dialup, not a chance in hell of ever doing enough Windows Update to get patched up to date. So the USB key will be part of my "Care Package" :-) Paul Similar, I guess! (Not so much dialup, but limited time I could stay with some of my supportees.) I'm not 100% positive about the "from-to" table on Service Packs. There was some rumblings, that SP0 to SP3 wouldn't work, or something goes missing. So I'd have to couch my advice, with perhaps a stop at SP1a, then on to SP3. I don't know if a web search has the necessary info on this or not. If you're running SP1 or SP2, as far as I know, installing SP3 should be enough. I generally don't take chances, and just archive anything that has the potential to be of use later. This means on some OS updates, I keep both 32 bit and 64 bit files. For example, I keep incremental files to bring Win8 mostly up to date, for both 32 bit and 64 bit. Currently my two Win8 paid installs are 64 bit, but that doesn't prevent me from archiving the 32 bit ones. Now, if there was a WSUSoffline for Windows 8, I'd likely end up downloading those files all over again. Paul |
#12
|
|||
|
|||
Is there a stop command?
"J. P. Gilliver (John)" wrote in message
... Is there a command that can be used, say in a batch file, that stops a running command (or command tree)? I mean, if I see in Task Manager that xyz.exe and abc.exe are running, is there something that I could use, such as stop abc.exe stop xyz.exe Running Program processes C:\My Program\abc.exe exist or C:\Windows\xyz.exe quit that would do the same - if run in a batch file - as stopping them using Task Manager's facilities would? [I tried "stop", and it doesn't exist (-:] Prev Play || Pause Next Stop [] Are for Controls run by Software If there is, would it need to know their full path? Yes the processes full path (And yes, I know killing processes is often not advisable.) processes Name Run Start exist quit |
Thread Tools | |
Display Modes | |
|
|