How can I use .bat files to run games with different power plans?

  1.    #1

    How can I use .bat files to run games with different power plans?


    I have created two .cmd files where I can change power plans really quick.
    The code in the .cmd files looks like this:

    powercfg /s 381b4222-f694-41f0-9685-ff5bb260df2e

    This works fine. But now I want to have a .bat file, which activates a power plan until the game is closed.

    For example:

    I want to change the power plan to high performance. Then a game out of origin or steam should start. When I close the game, power plan should switch back to balanced.

    I tried following code, but this still does not work:

    start /b "c:\users"username"\desktop" performance.cmd
    start /d "d:\games\origin" originclientservice.exe
    start /d "d:\games\origin" originwebservice.exe
    start /d "d:games\origin\origin games\mass effect andromeda" masseffectandromeda.exe
    start /b "c:\users"username"\desktop" balanced.cmd

    The game starts, but the balanced power plan is still active. How can I say, that the .bat file has to wait until the game is closed?
      My ComputerSystem Spec

  2. Berton's Avatar
    Posts : 5,875
    Win10 Home and Pro, Win10 Insider Preview, WinXP Home Premium, Linux Mint

    Usually putting Pause on the line after a command keeps the .bat file open but the usher has to hit Enter for the file to complete. Don't have a solution for the game program to control that.
      My ComputerSystem Spec

  3.    #3

    I changed code to this and this works but is not optimal:

    start /b "c:\users"username"\desktop" performance.cmd
    start /d "d:\games\origin\origin games\mass effect andromeda" masseffectandromeda.exe
    start /wait "" "c:\users"username"\desktop" balanced.cmd

    But now desktop directory opens and I have to activate balanced.cmd manually after closing the game.
      My ComputerSystem Spec

  4.    #4

    Do you find it makes a difference? Certainly for me games don't run any better using high performance compared to balanced.

    You can't really do this easily (except for clicking on something manually) as the OS doesn't have a trigger for ending a process AFAIK.

    You could write a program to see if d:\games\origin\origin games\mass effect andromeda was running or not and switch power plan.

    Something like this - powershell - How to Correctly Check if a Process is running and Stop it - Stack Overflow but add a pause every 5 seconds or something.

    There would be a minor (probably negligible) impact and may not actually be worth it. You could do it though.

    Technically of course you could put a rocking horse on a Porsche but unless you have a reason to do so it may be pointless.

    I don't find Power Plans make any difference personally as Balanced will take whatever resources it needs anyway.
      My ComputerSystem Spec

  5.    #5

    If you really need to do sthg like that you can use e.g. Autohotkey.

    Once the game has been launched, the script (which is still running) runs a loop to test for the presence of the game process, until not present, then restores your original power plan.
      My ComputersSystem Spec

  6. TairikuOkami's Avatar
    Posts : 3,673
    Home 1903 x64 10.0.18362.53

    You can try Process Lasso, among other things, it changes power profiles.
      My ComputerSystem Spec


Related Threads
How to Reset and Restore Power Plans to Default Settings in Windows 10 A power plan is a collection of hardware and system settings that manages how computers use and conserve power. A power plan is also known as a power scheme. You can create...
After updating to the Anniversary Update I no longer have access to my photos, game files, etc. They are located on the same drive (C:\) as WIN 10. Here is the mssg in the window that pops up: "Windows cannot access the specified device, path,...
Solved Where are Power Plans Stored? in Performance & Maintenance
I've just done a clean install on my Dell Inspiron 7537 laptop. I had a Dell supplied power plan on the previous W10 installation (upgraded from W8.1). Where are these plans stored so I can recover the previous Dell plan?
Hello, I have been having problems with Kernel power error. It has been causing bsods while playing games for more than a hour. I am suspecting it is a problems with my drivers, or that it is my system. Specs: 4690k stock 980ti EVGA acx+ ASUS...
Problem with power plans in Performance & Maintenance
When I plug in my computer on battery, it always set to default using "Power4Gear High Performance". Since I don't want to use it, I deleted it and chose "High performance" instead. But later on, when I plug in my computer on battery again, the...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:00.
Find Us