0

Okay so I managed to make the batch file start up my completely potato game on my potato laptop (this is just a laptop for coding practice, side projects, surfing the internet etc) upon logging in. Great.

But now how do I make the same batch file execute another command separately, namely that upon quitting the game, I"ll be automatically logged out of my win 10 user account?

I know it"ll be "logoff.exe" I think, but how do I make the script get the order of commands right? ie first launch the game and IF I quit the game it"ll log me out?

2 Answers2

0
@ECHO OFF

START "" "steam://rungameid/40970"
Timeout /T 25 /Nobreak


:LOOP
tasklist | find /i "STRONGHOLD" >nul 2>&1
IF ERRORLEVEL 1 (
  GOTO CONTINUE
) ELSE (
  ECHO STRONGHOLD is still running
  Timeout /T 5 /Nobreak
  GOTO LOOP
)

:CONTINUE
echo exited
SHUTDOWN /l /f
0
@ECHO OFF

:: This batch file start program1, after closing it logs off pc

TITLE my auto progam starter and loggoff on quit(sorry for the typing
errors)

ECHO Please wait... starting program1

ECHO ============================

START /WAIT steam://rungameid/40970

ECHO logging you off now...

TASKKILL steam 

(or what the steam process is called, im not sure, should close both the steam app and the game, if not add additional takkill for the gameprocess)

shutdown -l