Google search feed for 15 September 2018:
PsSuspend
tool from PsTools
(Microsoft sysinternals
utilities pack)
Since this is some kind official tool, it may be the best choice for simple scripts and automation.
Running PsSuspend with a process ID directs it to suspend or resume the process of that ID on the local computer. If you specify a process name PsSuspend will suspend or resume all processes that have that name. Specify the -r switch to resume suspended processes.
Usage: pssuspend [- ] [-r] [\\computer [-u username] [-p password]] <process name | process id>
Simple program using Windows API: SuspendThread
and ReasumeThread
Windows has some functions realated to suspending and reasuming threads (so process some kind alos). The kernel32.dll
library provides SuspendThread
and ReasumeThread
. Warning! There also are 64-bit counterparts for this functions Wow64SuspendThread
and Wow64ResumeThread
(which doesn't have official documentation).
There is nice, small application that uses that technique also version in C/C++ also on CodeProject (source code available).
Usage: pausep PID [/r]
(/r
switch reasumes the process).
There is version in C# .NET also on CodeProject.
More user-friendly, command line (Powershell) method from that answer:
As I said Windows command line has not any utility to do that but you
can invoke a Windows API function from PowerShell. First install
Invoke-WindowsApi script then you can write this:
Invoke-WindowsApi "kernel32" ([bool]) "DebugActiveProcess" @([int]) @(process_id_here)
Similar technique was used to create this PowerScript script created for process pausing.
Run("C:\SysinternalsSuite\pssuspend.exe onedrive", "", @SW_HIDE)
Sleep(5000)
Run("C:\SysinternalsSuite\pssuspend.exe onedrive -r", "", @SW_HIDE)
Adjust the process as required from onedrive above. You can save and then right click and choose "Complie Script (x86)". This will generate you an exe. Adjust it you want to sleep (e.g. 3 secs) and unsuspend, create an exe for each task etc.