1.    07 Apr 2017 #1
    Join Date : Apr 2017
    Posts : 2
    Windows 10

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


    Hello,

    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
    exit

    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.    07 Apr 2017 #2
    Join Date : Aug 2014
    Forever West
    Posts : 3,926
    Win10 Home and Pro, Win10 Insider Preview, Win7 Home, 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.    07 Apr 2017 #3
    Join Date : Apr 2017
    Posts : 2
    Windows 10
    Thread Starter

    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.    07 Apr 2017 #4
    Join Date : Jul 2015
    Posts : 3,755
    10 Pro

    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.    08 Apr 2017 #5
    Join Date : Jan 2015
    UK, Midlands
    Posts : 11,069
    Win 10 Pro (1703)

    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 ComputerSystem Spec
  6.    08 Apr 2017 #6
    Join Date : Oct 2014
    Trnava
    Posts : 2,870
    Windows 10.4 Home 1709 x64

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

 


Similar Threads
Thread Forum
Performance & Maintenance Reset and Restore Power Plans to Default Settings in Windows 10
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...
Tutorials
After Ann. Update I no longer have permission to access files, games..
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,...
General Support
Solved Where are Power Plans Stored?
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?
Performance & Maintenance
BSOD error 0x124, kernel power while playing games after 1-2 hours
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...
BSOD Crashes and Debugging
Problem with power plans
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...
Performance & Maintenance
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 08:11.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums