Page 1 of 1

Starting files.

Posted: 17 Jul 2007 21:40
by Powermean
Hello.
I'm pretty new to batch, and want to learn easy, funny stuff to do with batch files.
First up, I read the "My First Batch File" tutorial.
And now I tought I would execute my own batch file, so I wrote this:

Code: Select all

@echo off
echo 'ay there!
pause
start C:\Program files\Mozilla Firefox\firefox.exe


But, it gives this error that the file cant be found, or that this file can't be found: "C:\Program files\Mozilla.".

I would love help, and if you got a easy tutorial on your hands, feel free to post it. :D

Sirencly

Powermean.

Posted: 17 Jul 2007 22:44
by DosItHelp
Powermean,

If you have spaces in the filename or path then you will need to put the whole thing in quotes like this:

start "C:\Program files\Mozilla Firefox\firefox.exe"

Otherwise the command interpreter cut's of the filename at the space character.

Hope this helps! :wink:

Posted: 18 Jul 2007 08:07
by Powermean
DosItHelp wrote:Powermean,

If you have spaces in the filename or path then you will need to put the whole thing in quotes like this:

start "C:\Program files\Mozilla Firefox\firefox.exe"

Otherwise the command interpreter cut's of the filename at the space character.

Hope this helps! :wink:


Yes, thanks alot DosItHelp! :D

But, is firefox supposed to start in a new cmd window? xD

Posted: 20 Jul 2007 22:27
by DosItHelp
Powermean,

To see why it opens a new console run: start /?
The start command uses the first quoted string as the window title. If nothing else follows then it opens a new command console. So what you want is this:

start "" "C:\Program files\Mozilla Firefox\firefox.exe"

Note, if you just want to start firefox you can do so without the start command:

"C:\Program files\Mozilla Firefox\firefox.exe"