batch files

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I'm making a .bat file to start multiple programs at one
time. Using the command: start iexplore.exe - I can get
explorer to start and works with others as well. What I
need help with is when I want to start a program that is
in the program files folder. When I put in something like
this:
start c:\program files\desktop sidebar\sidebar.exe

It doesn't work because of the spaces in the folder/path
names. It sees it as c:\program
How do I get it to "see" the spaces and goto the right
folder/path?

Thanks,
Mike
 
You could try using DOS file names and see if you have better success. DOS
imposes and eight-character limit, with the tilde (~) and a number being the
truncation point. For example, "C:\Program Files" would translate into
"C:\Progra~1". You may want to try "C:\Progra~1\Deskto~1\sidebar.exe"; keep
in mind that similar names will be incremented in order. Lets say you have
"Program Files\Desktop Junk" and "Program Files\Desktop Sidemenu"; the first
would be c:\progra~1\deskto~1 in DOS, and the second would be
c:\progra~1\deskto~2. HTH.

--
Tony Talmage
Web Developer
Graphic Education Corporation
http://www.graphiced.com
(888) 354-6600
 
Mike said:
I'm making a .bat file to start multiple programs at one
time. Using the command: start iexplore.exe - I can get
explorer to start and works with others as well. What I
need help with is when I want to start a program that is
in the program files folder. When I put in something like
this:
start c:\program files\desktop sidebar\sidebar.exe

It doesn't work because of the spaces in the folder/path
names. It sees it as c:\program
How do I get it to "see" the spaces and goto the right
folder/path?

Thanks,
Mike

Use double quotes.

start "c:\program files\desktop sidebar\sidebar.exe"


FWIW. It might be better to use the ProgramFiles variable
rather than a fixed refernce to "c:\program files".

start "%ProgramFiles%\desktop sidebar\sidebar.exe"

Bob
 
-----Original Message-----


Use double quotes.

start "c:\program files\desktop sidebar\sidebar.exe"


FWIW. It might be better to use the ProgramFiles variable
rather than a fixed refernce to "c:\program files".

start "%ProgramFiles%\desktop sidebar\sidebar.exe"

Bob

Thanks for the info. I didn't know about the program
files variable, only knew the system one. I will try that
and the quotes. Thanks.
Mike
 
Thanks for the info. I didn't know about the program
files variable, only knew the system one. I will try that
and the quotes. Thanks.
Mike

Some other variables that may be useful -

ALLUSERSPROFILE
APPDATA
CommonProgramFiles
HOMEDRIVE
HOMEPATH
LOGONSERVER
ProgramFiles
SystemDrive
SystemRoot
TEMP
TMP
USERDOMAIN
USERNAME
USERPROFILE
WINDIR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top