The Witcher 2: Assassins of Kings Enhanced Edition

The Witcher 2: Assassins of Kings Enhanced Edition

Alakratt Dec 20, 2022 @ 10:28pm
2
1
Auto-set the CPU affinity on launch
This fix uses a batch file to launch the game with the desired CPU affinity set. This has only been tested in Windows 11 w/ 7950X CPU.
  1. Create a windows batch file with the following line in a text editor, like notepad.
    • %comspec% /C start /normal /affinity 1ff Launcher.exe

    • 1ff is for 8 cores, f is for 4, please set accordingly to your hardware.

  2. Save it, name it what you'd like, for this example I'll name it launchwaffinity.bat. Include .bat at the end of the name to create the batch file.

  3. Place the batch file in the game's install folder.

  4. Back in Steam, in the game's launch options type the following
    • <path-to-batch-file> %command%

    • i.e.
      "D:\SteamLibrary\steamapps\common\the witcher 2\launchwaffinity.bat" %command%

  5. Click Play and (hopefully) enjoy!

Note 1: The path to the batch file in the launch options needs to be wrapped in double quotes ("example"). This is to escape the spaces and slashes, there are other ways but just do it like this ok.

Note 2: It's been mostly recommended to set the affinity to 4 but 8 cores work too, at least for me. Try it out.

Note 3: The equivalent can be done in linux, instead of a batch it'd be a script. As for %command%, I don't remember if it's the same in linux.

Note 4: I did not have to set a compatibility mode, nor set the launcher(s) to run as admin, nor anything else, just this.

This also works for other games that need their CPU affinity limited to run, like Assassin's Creed Director's Cut.
Last edited by Alakratt; Jan 26, 2023 @ 1:10am
< >
Showing 1-14 of 14 comments
Alakratt Dec 23, 2022 @ 2:35pm 
Not sure if there's a cli command for that, I haven't checked. This fix is for the game crashing right after the ubisoft intro.
Just Guy 0_0 Dec 23, 2022 @ 3:23pm 
I dont have any issues , tried this to see if I can get more fps , but I got 20 fps less with forcing 8 cores , 30 fps less with forcing 4 cores , so I guess My GPU doesn't like higher CPU utilisation. :/

My Gpu is RTX 3080
CPU is AMD Ryzen™ 7 5800X3D

My CPU usage is 0% all the time , when trying your way to use 8 cores it increases to 5 % usage but then the fps drops by 20.

Last edited by Just Guy 0_0; Dec 23, 2022 @ 3:25pm
Alakratt Dec 23, 2022 @ 7:47pm 
I was crashing on startup because my cpu has more than 8 cores. It doesn't seem like you need this fix since it wasn't crashing.
Coolman6564 Jan 4, 2023 @ 10:31pm 
100% worked as advertised! I'm on a Xeon 22H/44L and was getting the looping from Wolf logo to launcher. Was only able to set a "f" (4 cores) to work, while 8, 16 resulted in nothing working. THANK YOU!
Alakratt Jan 5, 2023 @ 4:47am 
@Coolman6564 that's awesome! You're welcome!
Atilla de Hun Feb 4, 2024 @ 1:01pm 
Hallo Alakrat you writes above how to start Witcher 2. I cannot find: in steam in the games launch options. Can you explain little bit easyer how to find it. Thanks
Zalqior Feb 15, 2024 @ 12:37am 
thanks mate, this works. FEB-2024 14900KF

TW2 is incredible game
Alakratt Feb 15, 2024 @ 4:37am 
Originally posted by Atilla de Hun:
Hallo Alakrat you writes above how to start Witcher 2. I cannot find: in steam in the games launch options. Can you explain little bit easyer how to find it. Thanks
Sorry for the late reply. After you click on a game in your library,
  1. click on Manage, the gear icon
  2. click on Properties
  3. under General you'll see Launch options.
the_redeemed777 May 5, 2024 @ 5:57pm 
Thanks! This is the simplest and best solution I've seen. Got the game working with a 14900k
DrNewcenstein May 5, 2024 @ 10:04pm 
This needs to be stickied. I finally did figure out how to get it by setting affinity in Task M(ism)anager, but "there's a trick to it". Run the launcher with all cores active, then launch the game. When it hangs, set its Affinity to 4 cores (didn't try more). Then set the Launcher's Affinity to 4 cores. Close both (or wait for the game to time out, bringing the launcher back up), then close the Launcher. Launch the Launcher again and the game should remember the Affinity settings.

Gonna try the batch file, though. Fkng Windows being Windows.
DrNewcenstein May 5, 2024 @ 10:15pm 
OK, just tried it. Windows still has selective trouble recognizing spaces in folder names, so the above instructions may not work as far as the directory name because Steam trips on the "the" in "the witcher 2".

TL;DR

Just put the batch file in the folder with Launcher.exe and put "affinity.bat %command%" in the startup options in Steam (or whatever you named the batch file), without the quotes.
Alakratt May 7, 2024 @ 7:09pm 
Originally posted by DrNewcenstein:
OK, just tried it. Windows still has selective trouble recognizing spaces in folder names, so the above instructions may not work as far as the directory name because Steam trips on the "the" in "the witcher 2".

TL;DR

Just put the batch file in the folder with Launcher.exe and put "affinity.bat %command%" in the startup options in Steam (or whatever you named the batch file), without the quotes.

%command% has to be outside the double quotes, only the file path should be inside the quotes. But if you got it working then what I'm typing doesn't matter. Anyways, the important thing is that you're playing the game!
KRUSHR May 19, 2024 @ 5:17pm 
to get working 31 cores use this 7fffffff

%comspec% /C start /normal /affinity 7fffffff Launcher.exe

13900ks cpu
This worked like a charm!! Thank you so much. I was nearly pulling my hair out trying to get this to work.

Thanks.
< >
Showing 1-14 of 14 comments
Per page: 1530 50