Setting CPU2 Affinity for StarCitizen.exe

Grexx

Space Marshal
Aug 29, 2016
6
14
2,175
RSI Handle
Grexxiggin
Hi all,

I wrote some batch files to help set the affinity on CPU2 when starcitizen.exe is maxing out and dogging your system.

First you want to create a powershell script to actually run the commands which set the affinity. This turns off affinity on CPU2, then back on again. Just like when you use task manager to do it. Be sure to copy and name everything exactly the same as much of this is case sensitive!

You can create all these files with notepad but make sure they are named correctly. (Not ending in .txt) I run this on Windows 7, but it should run fine on Win8 and Win10.

First file is called 'StarAffinity.ps1' and it should have 3 lines:

$Process = Get-Process StarCitizen
$Process.ProcessorAffinity = 251
$Process.ProcessorAffinity = 255​

Second file is called 'start_sc.bat' and has 1 line. Save it in the same location as the first file.

powershell.exe -ExecutionPolicy Bypass -file StarAffinity.ps1​

You can run the second file after starcitizen.exe is running and it will popup a command window to run the powershell commands.

If you want to hide the command window, then you can make an optional third file.

Third file is called 'set_affinity_silent.vbs' and has 3 lines. Set the file path in it to where you saved the start_sc.bat file.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\start_sc.bat" & Chr(34), 0
Set WshShell = Nothing​

This is some simple vbscript which hides the command prompt window from popping up. You can make a shortcut to the .vbs or .bat file on your desktop to run this. You can also set a hotkey to the shortcut to make it easier still.

I have been using this code for a while and it works great. Just make sure star citizen is up and running before you run this. It can be run when you are at the main menu.

Stoutman
 
  • Like
Reactions: AstroSam

AstroSam

Barrista
Mar 8, 2016
5,884
19,636
1,525
RSI Handle
AstroSam
Hi all,

I wrote some batch files to help set the affinity on CPU2 when starcitizen.exe is maxing out and dogging your system.

First you want to create a powershell script to actually run the commands which set the affinity. This turns off affinity on CPU2, then back on again. Just like when you use task manager to do it. Be sure to copy and name everything exactly the same as much of this is case sensitive!

You can create all these files with notepad but make sure they are named correctly. (Not ending in .txt) I run this on Windows 7, but it should run fine on Win8 and Win10.

First file is called 'StarAffinity.ps1' and it should have 3 lines:

$Process = Get-Process StarCitizen
$Process.ProcessorAffinity = 251
$Process.ProcessorAffinity = 255​

Second file is called 'start_sc.bat' and has 1 line. Save it in the same location as the first file.

powershell.exe -ExecutionPolicy Bypass -file StarAffinity.ps1​

You can run the second file after starcitizen.exe is running and it will popup a command window to run the powershell commands.

If you want to hide the command window, then you can make an optional third file.

Third file is called 'set_affinity_silent.vbs' and has 3 lines. Set the file path in it to where you saved the start_sc.bat file.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\start_sc.bat" & Chr(34), 0
Set WshShell = Nothing​

This is some simple vbscript which hides the command prompt window from popping up. You can make a shortcut to the .vbs or .bat file on your desktop to run this. You can also set a hotkey to the shortcut to make it easier still.

I have been using this code for a while and it works great. Just make sure star citizen is up and running before you run this. It can be run when you are at the main menu.

Stoutman
I just wanted to mention that I'm still using this little workaround and it works perfectly! Very good work!
Mentioned it in the issue council here: https://robertsspaceindustries.com/community/issue-council/star-citizen-alpha/SC-39781-CPU_Load_100__on_single_core?
 
Forgot your password?