What's wrong with my batch file?

Advice Pro

Distinguished
Feb 25, 2009
29
1
18,580
I wrote my first batch file in Notepad and save it as Firefox.bat:

@echo off
start firefox.exe


When I ran Firefox.bat, I got an error message reading:

Windows cannot find 'firefox.exe'. Make sure you typed the name correctly, and then try again.


Firefox.exe it's clearly in its folder:

 
Solution
No, No:

@echo off
start "C:\Program Files\Mozilla Firefox\firefox.exe"

(Actually, the "start" is redundant. You could just put

@echo off
"C:\Program Files\Mozilla Firefox\firefox.exe"
)
That folder is not (I presume) in the default PATH variable. Put the full path to the program in your batch file:

start "C:\Program Files\Mozilla Firefox\firefox.exe"
 
So, like this:

@echo off
start firefox.exe
"C:\Program Files\Mozilla Firefox\firefox.exe"

Even though this starts up Firefox, I still get the error message.
 
No, No:

@echo off
start "C:\Program Files\Mozilla Firefox\firefox.exe"

(Actually, the "start" is redundant. You could just put

@echo off
"C:\Program Files\Mozilla Firefox\firefox.exe"
)
 
Solution