Starting files.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Powermean
Posts: 3
Joined: 17 Jul 2007 21:31

Starting files.

#1 Post by Powermean » 17 Jul 2007 21:40

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.

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 17 Jul 2007 22:44

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:

Powermean
Posts: 3
Joined: 17 Jul 2007 21:31

#3 Post by Powermean » 18 Jul 2007 08:07

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

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#4 Post by DosItHelp » 20 Jul 2007 22:27

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"

Post Reply