I have two . exe application that conflict eachother ( App_A and App_B). I want to warn the user when he launch App_B if App_A is already running.

ps: the warning message must really open before App_B launch, not 1 sec after. The message warning would be :

Are you sure you want to launch App_B ? App_A is already running! Yes/ No

The user can try to launch App_B either from desktop shortcut of from a associated file. (user click on the file and it auto-launch App_B to edit the file.)

App_A and App_B aren't my software, I can't edit them. I think I must use an external automation software.

Does somebody have any idea on which software I could use ? I have tried Window scheduler with batch file (no sucess), but I am open to any other solution. I have tried with automation tool like Eventghost with no sucess

  • I'm guessing these aren't programs you have access to the source code for? Mutex's could be used to this effect. Otherwise you could create a batch file to do so, something like this but using the CHOICE command. – Jonno Dec 23 '15 at 15:20
  • no I don't have source. the problem with batch is this : if user double-click on a default-binded file, window will open App_B and not the batch script, so the batch solution would be bypassed – n0tis Dec 23 '15 at 15:21
  • I can't really see any way around that, other than to not allow people to open file types associated with the application and force them to open it via a batch. – Jonno Dec 23 '15 at 15:24
  • @RogUE I think the OP means that they want to retain the functionality to open associated file types (EG, if you open a .xls file it'll open through Excel). This would bypass this entirely, although I might have misinterpreted this? – Jonno Dec 23 '15 at 15:37
  • @Jonno You are right. I should have used the term file-assiciation, I will edit – n0tis Dec 23 '15 at 15:46

Something to try:

Example batch file (obviously untested ;) ):

@echo off
REM Check for process
tasklist /fi "Imagename eq App_A.exe" 2>NUL | find /i /n "App_A.exe">NUL
REM If it isn't found (errorlevel > 0) launch App_B
if %ERRORLEVEL% GTR 0 goto LaunchB

REM Otherwise (errorlevel 0) it's been found, so ask for confirmation...
choice /C YN /M "App_A is running, continue launching App_B?"
if %ERRORLEVEL% EQU 1 goto LaunchB
if %ERRORLEVEL% GTR 1 exit

App_B2.exe %1 %2 %3 %4 %5
  • Thank you ! The batch work perfectly :D. However I have some problem to compile it to exe: I have tried with this tool battoexeconverter.com but then the exe say "attrib" doesn't exist, then I tried with this tool : f2ko.de/en/b2e.php, but here the exe simply output the third line of your script, without doing anything else... It's like some of this complex scipt isn't supported by exe compilator. Any Idea ? – n0tis Dec 23 '15 at 17:34
  • I converted that example batch using the tool from battoexeconverter.com without problem, and it works as expected. Perhaps create a new question about the problem converting your batch to an EXE with that tool, and include the exact code you are trying to convert, as well as the exact error message(s) you receive when you try to run it. – Ƭᴇcʜιᴇ007 Dec 23 '15 at 18:05
  • okay I will do that, thanks again for your code – n0tis Dec 23 '15 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.