Recipe 10.4. Suspending a Process


You want to suspend a process from running. This is helpful if you want to temporarily stop an application, perhaps due to high CPU consumption, but you don't want to kill it. This can give you an opportunity to launch further diagnostics utilities to troubleshoot the process.


Using downloadable software

  1. Open the Sysinternals Process Explorer tool (procexp.exe).

  2. To suspend a process, right-click on the target process and select Suspend.

  3. To resume a process, right-click on the target process and select Resume.

Sysinternals also has a command-line tool to suspend processes:

> pssuspend <PID>

And this resumes a process:

> pssuspend -r <PID>

Using VBScript

Currently, no scripting API supports suspending processes. However, if you are so inclined, you can use the SuspendThread and ResumeThread functions that are defined in kernel.lib with a language like Visual Basic.


Applications are much better behaved these days than they were a few years ago, but that still doesn't mean you won't see one peg the CPU on a system and render it virtually useless from time to time.

You can specify alternate credentials with the pssuspend command using the -u (user) and -p (password) options. If you specify -u without -p, it will prompt you to enter the password (this is the more secure way to do it). Here is an example command line:

> pssuspend \\jamison -u rallen notepad.exe

Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: