kukris Posted June 23, 2006 Share Posted June 23, 2006 Hello,I want to execute programs from a batch file. Now there are programsin folders with spaces. I tried thisstart "c:\my prog\prog.exe"but the start command doesn't like ". I also tried to replace the pathby 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 More sharing options...
egrath Posted June 23, 2006 Share Posted June 23, 2006 Hi Kukris,just try the following instead:start C:\"my prog"\prog.exeBye, Egon Link to comment Share on other sites More sharing options...
kukris Posted June 23, 2006 Author Share Posted June 23, 2006 Thanks egrath, that works. Link to comment Share on other sites More sharing options...
Sonic Posted June 23, 2006 Share Posted June 23, 2006 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 More sharing options...
Yzöwl Posted June 23, 2006 Share Posted June 23, 2006 (edited) As Sonic has stated, using the incorrect syntax for the command has caused the problemstart "" "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 June 23, 2006 by Yzöwl Link to comment Share on other sites More sharing options...
LLXX Posted June 23, 2006 Share Posted June 23, 2006 ...or you could just use the short 8.3 filename... Link to comment Share on other sites More sharing options...
kukris Posted June 24, 2006 Author Share Posted June 24, 2006 As Sonic has stated, using the incorrect syntax for the command has caused the problemstart "" "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.exeIt just works. According to Sonic, it shouldn't work, but it does. I also triedstart "Test" "c:\my prog\prog.exe"That works, too. Just try it yourself. Link to comment Share on other sites More sharing options...
Andromeda43 Posted June 24, 2006 Share Posted June 24, 2006 .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. Good Luck,Andromeda43 Link to comment Share on other sites More sharing options...
T D Posted June 24, 2006 Share Posted June 24, 2006 How do you find out the 8.3 filename for a long filename?Thanks. Link to comment Share on other sites More sharing options...
kukris Posted June 24, 2006 Author Share Posted June 24, 2006 @Andromeda43The command start offers some options that are quite useful, especially /wait. Link to comment Share on other sites More sharing options...
Sonic Posted June 24, 2006 Share Posted June 24, 2006 As Sonic has stated, using the incorrect syntax for the command has caused the problemstart "" "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.exeI 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 More sharing options...
egrath Posted June 24, 2006 Share Posted June 24, 2006 How do you find out the 8.3 filename for a long filename?Thanks.Hi,use:dir /xto see the 8.3 Filenames next to the long ones.Bye, Egon Link to comment Share on other sites More sharing options...
T D Posted June 25, 2006 Share Posted June 25, 2006 Thx egrath. Link to comment Share on other sites More sharing options...
bledd Posted June 25, 2006 Share Posted June 25, 2006 just don't put start in front of it.. Link to comment Share on other sites More sharing options...
Andromeda43 Posted June 25, 2006 Share Posted June 25, 2006 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.exeUse 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now