@echo off for /f %%i in ('powershell -command "Get-CimInstance Win32_VideoController | ForEach-Object { $i = 0 } { if ($_.Name -match 'Graphics') { $i } else { $i++ } }"') do set GPU_INDEX=%%i start "" ".\AutoO.exe" -RenderOffscreen -nosound -log -graphicsadapter=%GPU_INDEX% exit