1

How do I make an exe run automatically when another exe is launched?

Example :

EXE 1 is launched & running

EXE 2 will run automatically once it see that the EXE 1 has already launched.

What is the command do I use in .bat file or autorun.inf?

KAL MOE
  • 13
  • 1
  • 4
  • sorry I meant i need the exe 2 to run ONLY if exe is running, so is there some command to say for example, if exe 1 is running, run exe 2 automatically. if i use the command bellow this will just run both same time which i dont want to do, i want exe 2 to run only if its see that exe 1 is running in the Windows Task Manager under processes. thanks – KAL MOE Oct 23 '12 at 21:40
  • @ Bali C. Thank you so much this works but only problem i need when example exe1.exe runs for exe2.exe to run thats without CLICKING on the batch . the above code works perfect only if i click on the batch. is there a way to make exe2.exe run automatically IF somehow the exe1.exe is running WITHOUT having to click on the batch file. – KAL MOE Oct 24 '12 at 17:44

2 Answers2

1

Here you go

start exe1.exe
:LOOP
tasklist /nh /fi "imagename eq exe1.exe" | find /i "exe1.exe" >nul && start exe2.exe || goto :LOOP

That will start exe1.exe and will keep looking to see if it has started before running exe2.exe.

Bali C
  • 30,582
  • 35
  • 123
  • 152
0
@ECHO OFF
START /D "path" myexe1.exe
START /D "path" myexe3.exe

Taken from here.

Then save the file as "somename.bat"

Edit

Due to your last comment here's what I found

@echo off
tasklist /nh /fi "imagename eq chrome.exe" | find /i "chrome.exe" >nul && (
    echo Windows Media Player is running
) || (
    echo Chrome is not running
)
pause>nul

I just copied the code from the link, google can be very helpful.

Community
  • 1
  • 1
spots
  • 2,483
  • 5
  • 23
  • 38