Processes - Set Affinity



<AMPROCESSES ACTIVITY="setaffinity" PROCESSNAME="Text" SAMEPROCESS="text" AFFINITY="number,number" />

See Also

Processes - Start | Processes - Set Priority | Processes - Get Info | Processes - End


Sets the processor affinity of a process. In Windows XP, Windows Vista, and Windows 7, applications run on all available cores of the processor by default. If you have a dual or quad core processor, then you can set affinity to an application to control which core of the processor an application can use. This gives you better control over processors when applications place demands on system resources.

NOTE: The processor affinity setting lasts as long as an application is open, when you close the application or restart the computer the affinity returns to the default settings. Also, It is recommended NOT TO change the process affinity for system processes.

Practical Usage

On a multi-CPU server, you can configure application pools to establish affinity between worker processes and CPUs in order to take advantage of more frequent CPU cache hits. You can assign one application or program to use only one processor while other applications run on other processors.


Process Properties







Find by Name





  2. PROCESS="C:\folder\process.exe

If enabled, specifies the name of the process in which to set. This parameter supports entry of the absolute (full) path or relative (file name only) path of the process. If this parameter is enabled, the Find by Process ID parameter becomes inactive. This parameter is enabled by default.

If multiple instances of the process exist, apply changes to

Text (options)


Upper Case


Indicates which process instance should be set in case more than one instance of a given process is running. The available options are:

  • Oldest (default) - Only the oldest running instance of the process will have its priority set.

  • Newest - Only the newest (last) running instance of the process will have its priority set.

  • None - No instance of the process will have its priority set.

  • All - All instances of the process will have its priority set.

Find by Process ID





If enabled, specifies the process ID of the process to set. If this parameter is enabled, the Find by Name  parameter becomes inactive. This parameter is disabled by default.

NOTE: Use the Processes - Get Info activity to retrieve the process ID of a given process.

Change process affinity to (comma-delimited list of CPU identifiers)





The comma delimited list of CPU identifiers (unique IDs) of the processors in which to set process affinity. For example, to utilize processors 1, 2 and 3, enter "1,2,3".

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder


NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.


Description: Set affinity of process "Photoshop.exe" to "1,3". If multiple instances of the process exist, apply changes to none.

<AMPROCESSES ACTIVITY="setaffinity" PROCESSNAME="Photoshop.exe" SAMEPROCESS="nothing" AFFINITY="1,3" />

↑ Top of Page