How can I run a batch file when Firefox starts?

-1

0

I want to run a .bat file when any .exe file (such as Firefox) is double clicked. I want to run this .bat file when Firefox runs. Is there any way to do this?

I tried with this batch code:

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\firefox.exe" /v Debugger /d "D:\Desktop\m.bat" /f

Here, m.bat is the file which I want to run when Firefox runs.

Image of my Registry: image of my registry

Muhammad Khaled

Posted 2017-04-21T11:44:15.467

Reputation: 9

Question was closed 2017-04-21T19:31:42.480

1

Relevant: I want to intercept a given program before it runs and run my own program first

– DavidPostill – 2017-04-21T12:13:52.680

ok but how do that – Muhammad Khaled – 2017-04-21T12:18:38.767

1The answer in the link tells you ... – DavidPostill – 2017-04-21T12:19:52.760

ok I understand the solution and appaly it but there is no any thing happen – Muhammad Khaled – 2017-04-21T12:54:25.493

1You didn't run the reg add command correctly. In the screen shot of your registry where it shows m.bat it should say firefox.exe. Also, the data of your Debugger value should be D:\Desktop\m.bat, not the dash you currently have. Look more closely at the proposed duplicate answer. – I say Reinstate Monica – 2017-04-21T18:32:36.403

thank you very much but the code is running m.bat instead of firefox I don't want that I want firefox run and m.bat running in background – Muhammad Khaled – 2017-04-22T10:06:34.400

Answers

1

You could use a batch file as wrapper that executes your instruction first and than runs Firefox or the reverse.

In this case you would let the shortcut to Firefox point to the batch.

jehutyy

Posted 2017-04-21T11:44:15.467

Reputation: 194

yes I want when user running firefox the batch file running in background but how to that – Muhammad Khaled – 2017-04-22T10:07:57.830