Hi all,
I am still a bit new to writing batch files so my question might be a bit dumb. Here comes:
Is it possible to run a batch file only if another exe (for instance notepad.exe) starts? And if so how would I do this?
Kind Regards,
Carnelain
Run bat file when starting an exe
Moderator: DosItHelp
Re: Run bat file when starting an exe
Possible? Yes, but not a good idea. You need a process (e.g. a second batch file) that is observing permanently if notepad is running or not running.
Better idea: use something like a starter batch.
Regards
aGerman
Code: Select all
@echo off &setlocal
set "processname=notepad.exe"
:loop
tasklist /fi "imagename eq %processname%" |find /i "%processname%" >nul ||goto loop
echo notepad is running
pause
Better idea: use something like a starter batch.
Code: Select all
@echo off &setlocal
start notepad.exe
:: your stuff here
Regards
aGerman