Ahmed Ali
Ahmed Ali

Reputation: 13

batch file start a program when closed

I need help writing a batch file that starts a program when I close the Command Prompt (batch file).

I know how to start a program when the batch file is running:

   @echo off
   Start [adress of application]

Upvotes: 1

Views: 167

Answers (1)

Fusseldieb
Fusseldieb

Reputation: 1374

I believe it's not possible, because when you terminate the batch (by pressing the red 'X' on top), it will end imediately without doing anything. But you can Read the user input, and if the user writes "Exit", it will run a program and close. I think you don't want that, but If you, then look at this: In Windows cmd, how do I prompt for user input and use the result in another command?

Upvotes: 1

Related Questions