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