locked
Blank spaces in DOS commands RRS feed

  • Question

  • I'm writing a .bat file containing old style DOS commands. Everything works well until there is a blank space in a directory or file name. Here is an example:

    copy c:\myDir\My file.dat .

    I know that there is a way to tell DOS that there is a blank space between "My" and "file" in the previous command. Do you know what it is?

    Thanks for your help.

    Tuesday, July 30, 2013 9:29 PM

Answers

  • Use double quotes, ie: copy "c:\myDir\My file.dat" "c:\program files (x86)\new destination\my file.dat"

    Cheers

    • Proposed as answer by Dave PatrickMVP Wednesday, July 31, 2013 12:59 AM
    • Marked as answer by MikeOnMSDN Wednesday, July 31, 2013 1:17 PM
    Tuesday, July 30, 2013 10:26 PM

All replies

  • Use double quotes, ie: copy "c:\myDir\My file.dat" "c:\program files (x86)\new destination\my file.dat"

    Cheers

    • Proposed as answer by Dave PatrickMVP Wednesday, July 31, 2013 12:59 AM
    • Marked as answer by MikeOnMSDN Wednesday, July 31, 2013 1:17 PM
    Tuesday, July 30, 2013 10:26 PM
  • Lloyd,

    Thanks! You did another good deed last night.

    Mike

    Wednesday, July 31, 2013 2:05 PM