I'm not a batch coder, but I'm trying to create a script that does the following once executed:
- enables the dedicated video card (laptop NVIDIA card)
- runs a specific video game and waits for its end
- once the game is terminated, disables the dGPU
The following code works great with simple programs like notepad.exe, since they start immidiatly:
// enable dedicated GPU
devcon enable "@PCI\VEN_10DE&DEV_1C8C&SUBSYS_8259103C&REV_A1\4&3455E2C8&0&0008"
// start notepad and wait for its termination
start /b /wait "" "C:\Windows\notepad.exe" || goto QUIT
:QUIT
// disable dedicated GPU
devcon disable "@PCI\VEN_10DE&DEV_1C8C&SUBSYS_8259103C&REV_A1\4&3455E2C8&0&0008"
exit
The problem is that if I change "notepad.exe" for some heavy video game (BF1 for example) which takes some time to start, the script doesn't wait for game's actual launch and proceeds with other command. So the result is:
- GPU is turned on
- GPU is turned off (script exit)
- After some time game starts (using Intel Graphics)
Is there a way to make the second command (start /wait) wait for game's actual launch?
The reason I need this script is: NVIDIA Optimus + Windows 10 = micro freezes
PS: sorry for my english.