# Create a batch file that will run a program then restart if closed



## dremits

Hi there,

I know creating batch files isn't programming but it seems the most appropriate forum (move as necessary). I was wondering how I would go about creating a batch file that would run a program and then if the program was closed it would immediately be restarted?

Thanks,


----------



## TheOutcaste

Code:


@Echo Off
:_Start
Start /W "" Notepad.exe
Goto _Start

Replace Notepad.exe with the [path]name of your program.
This will have a visible window unless run from a shortcut set to Minimize.
It will also have a taskbar button. There are programs you can use to hide a command Window, or this can be done in VScript.


----------

