Jump to content

[Help] Starting programs with spaces in folder (batch)


kukris
 Share

Recommended Posts

Hello,

I want to execute programs from a batch file. Now there are programs

in folders with spaces. I tried this

start "c:\my prog\prog.exe"

but the start command doesn't like ". I also tried to replace the path

by a variable, but still no luck.

Has anyone a solution to this?

Title edited -- Please, use [TAGS] in your topic's title.

--Sonic

Link to comment
Share on other sites


In fact in 'start', the first quotes is used to set the name of the new window created and the second quotes is used for the file path. Like this:

start /wait "Installing something ..." "%temp%\F o l d e r\Windows Live Messenger.msi" /qb

Note the argument of the executed file isn't inside in second quotes, it's normal way.

edit: typo

Link to comment
Share on other sites

As Sonic has stated, using the incorrect syntax for the command has caused the problem

start "" "c:\my prog\prog.exe"

I have posted here however, not to affirm Sonics advice, more out of intrigue…

How did you get this to work?

start C:\"my prog"\prog.exe
Edited by Yzöwl
Link to comment
Share on other sites

As Sonic has stated, using the incorrect syntax for the command has caused the problem
start "" "c:\my prog\prog.exe"

I have posted here however, not to affirm Sonics advice, more out of intrigue…

How did you get this to work?

start C:\"my prog"\prog.exe

It just works. According to Sonic, it shouldn't work, but it does. I also tried

start "Test" "c:\my prog\prog.exe"

That works, too. Just try it yourself.

Link to comment
Share on other sites

.or you could just use the short 8.3 filename...

Duh! Did I miss something in the 26 years that I've been running stuff from batch files?

In all that time I've never used the word "Start", or "Run" or "Sickem" or even "GiddyUp!".

Why would you ever need to.???

Any program file name placed on a line by itself in a batch file will just RUN.

The only "IF" involved is, 'Can the OS find the file'.

If the OS can't find the file within its own path statement, then include the path in the command line within your batch file.

"C:\Program Files\Ahead\Nero\nero.exe"

The above line, for instance, in a batch file, will run the Nero program.

It's been like this ever since Windows came up with 'Long Filenames'.

Life was sure simpler in the DOS days when all names of files and folders were just 8 digits long. :yes:

Good Luck,

Andromeda43

Link to comment
Share on other sites

As Sonic has stated, using the incorrect syntax for the command has caused the problem
start "" "c:\my prog\prog.exe"

I have posted here however, not to affirm Sonics advice, more out of intrigue…

How did you get this to work?

start C:\"my prog"\prog.exe

I have tested

start c:\"t t"\t.txt

and it open the right 1.txt document here. But the correct usage is the method I have posted.

Link to comment
Share on other sites

just don't put start in front of it..

(Thanks Bledd)

Did I not just finish saying that Start is NOT required to run a program?

Just put the program name, with path if required, on a line by itself and it will run.

It's been working like that for over twenty six years that I personally know about.

I even gave a perfectly easy to read example.

If the statement includes long filenames, either with or without spaces, then put the whole line inside of quotes and it will execute just fine.

If you ever need to make a 8.3 out of a long name like "Easy Cleaner.exe", then do it like this:

EasyCl~1.exe

Use the first six letters, leaving out any spaces, and then add the tilde one (~1) followed by the extension.

I use this method a lot when I'm working in DOS to remove some crapola file from my HD.

cheers.gif

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...