O(V)eGA_l2el) Posted April 29, 2007 Posted April 29, 2007 I have noticed one of my batch files contains a directory name with a space and does not execute correctly. Although, other batch files containing names with spaces execute with no problems. What am I overlooking in this particular batch file. Should I use quotation marks, a tilde, or some other character to signify a space within filenames? Syntax Example: @echo off echo Starting fileone... cd H:\Directory One\Subdirectory\fileonedirectory start fileone.exe Share this post Link to post Share on other sites More sharing options...
Nemo Posted April 29, 2007 Posted April 29, 2007 I have noticed one of my batch files contains a directory name with a space and does not execute correctly. Although, other batch files containing names with spaces execute with no problems. What am I overlooking in this particular batch file. Should I use quotation marks, a tilde, or some other character to signify a space within filenames? Syntax Example: @echo off echo Starting fileone... cd H:\Directory One\Subdirectory\fileonedirectory start fileone.exe Try enclosing the directory name in quotes like this: cd "H:\Directory One\Subdirectory\fileonedirectory" Share this post Link to post Share on other sites More sharing options...
O(V)eGA_l2el) Posted April 29, 2007 Posted April 29, 2007 Try enclosing the directory name in quotes like this: cd "H:\Directory One\Subdirectory\fileonedirectory" Enclosing that line does not work; the results remain the same (can not find fileone.exe). Share this post Link to post Share on other sites More sharing options...
Nemo Posted April 29, 2007 Posted April 29, 2007 What about: start "H:\Directory One\Subdirectory\fileonedirectory\fileone.exe" Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted April 29, 2007 Posted April 29, 2007 Perhaps a silly question, but are you sure you have the path right? I think enclosing in "'s should actually work... Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted May 7, 2007 Posted May 7, 2007 According to the CD help documentation: CHDIR command does not treat spaces as deliminiters [...] so it is possible to CD into a directory with a space. So chances are you've got the directory wrong, or you're not CDing correctly. Ah heck, I'll quote it: Microsoft Windows XP [Version 5.1.2600] Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now