|
Need batch file to reset dual core affinity..
(Close and mark as solved) | (Mark as unsolved)
|
|
07-30-2009, 05:29 AM
Post: #1
|
|||
|
|||
|
Need batch file to reset dual core affinity..
Is its possible to write a batch file that executes an game.exe that wud change the process affinity to the 1st core only then back to 2nd core only then back to both cores as normal?There is a game that needs that kind of weird tweak to work flawlessly in vista and win7.Please let me know if that can be accomplished..thanks..
|
|||
|
07-30-2009, 05:57 AM
(This post was last modified: 07-30-2009 01:29 PM by Nilpo.)
Post: #2
|
|||
|
|||
|
Need batch file to reset dual core affinity..
In general, it's a bad idea to choose your own affinity. The CPU scheduler will often do a better job than you will and this can result in performance loss.
However, if you're sure of your situation there are two different ways to launch a program from batch with a specific affinity. The first uses NT Batch's start command, the second uses Microsoft SysInternals' psexec program. Either one will work. Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
07-30-2009, 06:23 AM
Post: #3
|
|||
|
|||
|
Need batch file to reset dual core affinity..
well i am sure of my situation but the thing is i have no experience with creating batch files and really would like u to help me and explain in detail and from scratch what i would need to do.....Meanwhile I would check out the psexec program from Microsoft and see if i can understand it and get started...thanks
|
|||
|
07-30-2009, 11:49 PM
Post: #4
|
|||
|
|||
|
Need batch file to reset dual core affinity..
A batch file is just a simple text file that lists a series of command lines to be executed in order. You can create one in Notepad and save it with a .bat file extension.
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
07-31-2009, 12:01 AM
Post: #5
|
|||
|
|||
|
Need batch file to reset dual core affinity..
Ok well I was able to understand what a batch file is.But my problem really is too put in the correct commands for it to work..The name of the game on the desktop icon is GTR Evolution,but in the program directory for the game I see ''RACE07'' which is the .exe that actually opens the game up...But I don't understand what am i to put in notepad and save it as .bat...Am I to just put in notepad:
start /affinity 1 program.exe start /affinity 2 program.exe close of and save it as a .bat extension file?I am new to this and would really like some more detailed information ok..thank you |
|||
|
07-31-2009, 01:44 PM
Post: #6
|
|||
|
|||
|
Need batch file to reset dual core affinity..
I'm not sure what you're trying to do.
Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
08-02-2009, 08:44 AM
Post: #7
|
|||
|
|||
|
Need batch file to reset dual core affinity..
Ok i would explain again.I have a game that i would like the affinity to be adjusted or reset so that the game would play good on win7 or vista.I am hoping that when i launch the game the batch command would switch of core 1 apply it...then switch off core 2 apply it then finally switch back to all cores or all processors...as long as the cores are switched on and off or reset i think I would be good...Please let me know if that can be accomplished.thanks...
|
|||
|
08-02-2009, 11:04 AM
(This post was last modified: 08-02-2009 11:07 AM by Nilpo.)
Post: #8
|
|||
|
|||
|
Need batch file to reset dual core affinity..
In standard scripting, there is no method of changing the affinity of a running process. That means that both batch and VBScript are out as options. There is however, a method provided by a .Net class that will allow you to change the affinity of a running process; and luckily for us, it's exposed to PowerShell, the next generation scripting technology available in both Windows Vista and Windows 7. To begin, you need to grab the current running process' instance using the Get-Process cmdlet.
Code: $game = Get-Process -name race07Once you have an object reference for the process, you can change its processor affinity using the ProcessorAffinity property of the System.Diagnostics.Process (the class object that was returned by the Get-Process cmdlet) .Net class. If you don't know what all of that means, that's ok. You can ignore the over speak and look at the example below. Code: $game.ProcessorAffinity = 0x0001Code: $game.ProcessorAffinity = 0x0002Code: $game.ProcessorAffinity = 0x0003Phew! Ok, so let's turn this jumbled mess into a script already! Open up notepad or some other simple text editor and add the following lines. Code: $game = Get-Process -name race07Sorry it's not a batch script, but it gets the job done! Scripting problems? Windows questions? Ask the Windows Guru! Stay up to date with all of my latest content. Follow me on Twitter! Help us help you! Post your exact error message with these easy tips! |
|||
|
08-02-2009, 11:27 AM
Post: #9
|
|||
|
|||
|
Need batch file to reset dual core affinity..
Why do you have to grab the game's instance? Why can't you just run the affinities?
undefined |
|||
|
08-02-2009, 11:45 AM
Post: #10
|
|||
|
|||
|
Need batch file to reset dual core affinity..
well thanks for this info...when i re-install back to windows 7.i woud put this into action..Thanks again ok.
|
|||
|
« Next Oldest | Next Newest »
|
| Forum Permissions |
| You cannot post new threads. You cannot post replies. You cannot post attachments. |
| HTML is turned off. MyCode is turned on. Smilies are turned on. [img] is turned on. |


Search
Member List
Calendar
Help




