Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Accommodating the White Spaces in a DOS command  (Read 3852 times)

0 Members and 1 Guest are viewing this topic.

md_ahirrao

    Topic Starter


    Starter

    Accommodating the White Spaces in a DOS command
    « on: January 15, 2009, 11:46:37 PM »
    hey friends, i want to know how to add white spaces in a DOS command.
    e.g. i have a folder named 'my documents' & another one named 'my archives'. now, if i want to copy some files from 'my documents' to 'my archives' using any DOS command, like 'copy' or 'xcopy', the syntax will be:
    copy c:\my documents\*.* d:\my archives  (Using copy)    OR
    xcopy c:\my documents\ d:\my archives    (Using Xcopy).

    The system throws the error: Invalid number of the parameters

    Is there any way to do this, apart from renaming the concerned folders(that is very frustrating, i tell u)?


    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Accommodating the White Spaces in a DOS command
    « Reply #1 on: January 15, 2009, 11:51:49 PM »
    Did you try this?
    Code: [Select]
    xcopy "c:\my documents\" "d:\my archives" 
    But why no do it in windows?

    BC_Programmer


      Mastermind
    • Typing is no substitute for thinking.
    • Thanked: 1140
      • Yes
      • Yes
      • BC-Programming.com
    • Certifications: List
    • Computer: Specs
    • Experience: Beginner
    • OS: Windows 11
    Re: Accommodating the White Spaces in a DOS command
    « Reply #2 on: January 15, 2009, 11:52:27 PM »
    hey friends, i want to know how to add white spaces in a DOS command.
    e.g. i have a folder named 'my documents' & another one named 'my archives'. now, if i want to copy some files from 'my documents' to 'my archives' using any DOS command, like 'copy' or 'xcopy', the syntax will be:
    copy c:\my documents\*.* d:\my archives  (Using copy)    OR
    xcopy c:\my documents\ d:\my archives    (Using Xcopy).

    The system throws the error: Invalid number of the parameters

    Is there any way to do this, apart from renaming the concerned folders(that is very frustrating, i tell u)?



    yes. put quotes around the names.

    Code: [Select]
    copy "c:\my documents\*.*" "d:\my archives"
    xcopy "c:\my documents\" "d:\my archives"  

    but why not just use explorer to copy.


    EDIT: lol.... beat me to it...
    I was trying to dereference Null Pointers before it was cool.

    md_ahirrao

      Topic Starter


      Starter

      Re: Accommodating the White Spaces in a DOS command
      « Reply #3 on: January 16, 2009, 12:33:46 AM »
      thanks BC_programmer.
      thanks Geek-9pm
      it worked