locked
Command Line will not accept file names that include spaces RRS feed

  • Question

  • To whom it may concern:

    When I attempt to use the CMD (Command Line) window it opens no problem however; when I attempt to enter a file name that includes a space using quotes or not the input is rejected

     

    Microsoft(R) Windows DOS
    (C)Copyright Microsoft Corp 1990-2001.

    C:\USERS\DEREKG~1>f:

    F:\>cd derek

    F:\DEREK>dir
     Volume in drive F is WhatisPossible-Interim Disc
     Volume Serial Number is 9A79-D066

     Directory of F:\DEREK

    22/01/2008  00:01    <DIR>          .
    22/01/2008  00:01    <DIR>          ..
    20/01/2008  20:21    <DIR>          Drive(D)
    22/01/2008  00:05    <DIR>          Webshots Data
                   0 File(s)              0 bytes
                   4 Dir(s)  299,581,509,632 bytes free

    F:\DEREK>cd Webshots Data
    Too many parameters - Data

    F:\DEREK>cd "Webshots Data"
    Parameter format not correct -  "Webshots

    F:\DEREK>

     

    Anyone else exprienced anything similar?

    • Moved by Carey FrischMVP, Moderator Monday, June 27, 2011 7:28 AM Moved to more appropriate forum category (From:Windows Vista Service Packs/Windows Server 2008 Service Packs)
    Tuesday, January 22, 2008 12:26 AM

All replies

  • Two things:

     

    1. Try creating a folder yourself that has a space in it to see if it is the OS

    2. Try using an extra space at the end or beginning such as " Webshots Data" or "Webshots Data " because if its created by an install program you won't be able to tell these two options.

     

    Tuesday, January 22, 2008 7:12 AM
  • Correct syntax is cd "f:\Webshots Data"
    Tuesday, January 22, 2008 12:09 PM
  • Cyanna, many thanks for the response which did not resolve the problem, please see the following:

     

    Microsoft(R) Windows DOS
    (C)Copyright Microsoft Corp 1990-2001.

    C:\USERS\DEREKG~1>d:

    D:\>dir *.
     Volume in drive D is WhatisPossible-GeneralData
     Volume Serial Number is 9AA7-0B21

     Directory of D:\

    22/01/2008  05:27    <DIR>          Derek
                   0 File(s)              0 bytes
                   1 Dir(s)  71,398,060,032 bytes free

    D:\>cd derek

    D:\DEREK>dir *.
     Volume in drive D is WhatisPossible-GeneralData
     Volume Serial Number is 9AA7-0B21

     Directory of D:\DEREK

    22/01/2008  05:27    <DIR>          .
    22/01/2008  05:27    <DIR>          ..
    22/01/2008  01:52    <DIR>          Adobe
    22/01/2008  01:52    <DIR>          Audacity Projects
    22/01/2008  01:52    <DIR>          Canon Utilities
    22/01/2008  01:52    <DIR>          CyberLink
    22/01/2008  01:52    <DIR>          Fax
    22/01/2008  01:52    <DIR>          Health & Fitness
    22/01/2008  01:52    <DIR>          ISP & Telephone Information
    22/01/2008  01:52    <DIR>          MapView
    22/01/2008  01:52    <DIR>          MGI
    22/01/2008  01:52    <DIR>          Microsoft Press
    22/01/2008  01:53    <DIR>          My Albums
    22/01/2008  01:53    <DIR>          My Computer Information
    22/01/2008  01:53    <DIR>          My Digital Editions
    22/01/2008  02:00    <DIR>          My DVDs
    22/01/2008  01:53    <DIR>          My eBooks
    22/01/2008  01:54    <DIR>          My Games
    22/01/2008  01:54    <DIR>          My Internet Errors
    22/01/2008  01:54    <DIR>          My Library
    22/01/2008  01:54    <DIR>          My Magazines
    22/01/2008  01:56    <DIR>          My Music
    22/01/2008  02:00    <DIR>          My Pictures
    22/01/2008  02:00    <DIR>          My Registry Backup Files
    22/01/2008  02:00    <DIR>          My Skype Content
    22/01/2008  02:00    <DIR>          My Skype Pictures
    22/01/2008  02:00    <DIR>          My Skype Received Files
    22/01/2008  05:27    <DIR>          My Videos
    22/01/2008  05:27    <DIR>          My Webs
    22/01/2008  05:27    <DIR>          RKSFax
    22/01/2008  05:27    <DIR>          Scanned Documents
    22/01/2008  05:27    <DIR>          Symantec
    22/01/2008  05:27    <DIR>          Travel
    22/01/2008  05:27    <DIR>          Webshots Data
                   0 File(s)              0 bytes
                  34 Dir(s)  71,398,060,032 bytes free

    D:\DEREK>cd "D:\Derek\My Music"
    Parameter format not correct -  "D:\Derek\My

    D:\DEREK>md "Test Test"

    D:\DEREK>cd "Test Test"
    Parameter format not correct -  "Test

    D:\DEREK>dir *.
     Volume in drive D is WhatisPossible-GeneralData
     Volume Serial Number is 9AA7-0B21

     Directory of D:\DEREK

    22/01/2008  12:18    <DIR>          .
    22/01/2008  12:18    <DIR>          ..
    22/01/2008  01:52    <DIR>          Adobe
    22/01/2008  01:52    <DIR>          Audacity Projects
    22/01/2008  01:52    <DIR>          Canon Utilities
    22/01/2008  01:52    <DIR>          CyberLink
    22/01/2008  01:52    <DIR>          Fax
    22/01/2008  01:52    <DIR>          Health & Fitness
    22/01/2008  01:52    <DIR>          ISP & Telephone Information
    22/01/2008  01:52    <DIR>          MapView
    22/01/2008  01:52    <DIR>          MGI
    22/01/2008  01:52    <DIR>          Microsoft Press
    22/01/2008  01:53    <DIR>          My Albums
    22/01/2008  01:53    <DIR>          My Computer Information
    22/01/2008  01:53    <DIR>          My Digital Editions
    22/01/2008  02:00    <DIR>          My DVDs
    22/01/2008  01:53    <DIR>          My eBooks
    22/01/2008  01:54    <DIR>          My Games
    22/01/2008  01:54    <DIR>          My Internet Errors
    22/01/2008  01:54    <DIR>          My Library
    22/01/2008  01:54    <DIR>          My Magazines
    22/01/2008  01:56    <DIR>          My Music
    22/01/2008  02:00    <DIR>          My Pictures
    22/01/2008  02:00    <DIR>          My Registry Backup Files
    22/01/2008  02:00    <DIR>          My Skype Content
    22/01/2008  02:00    <DIR>          My Skype Pictures
    22/01/2008  02:00    <DIR>          My Skype Received Files
    22/01/2008  05:27    <DIR>          My Videos
    22/01/2008  05:27    <DIR>          My Webs
    22/01/2008  05:27    <DIR>          RKSFax
    22/01/2008  05:27    <DIR>          Scanned Documents
    22/01/2008  05:27    <DIR>          Symantec
    22/01/2008  12:18    <DIR>          Test Test
    22/01/2008  05:27    <DIR>          Travel
    22/01/2008  05:27    <DIR>          Webshots Data
                   0 File(s)              0 bytes
                  35 Dir(s)  71,398,060,032 bytes free

    D:\DEREK>

     

    Tuesday, January 22, 2008 12:22 PM
  • Thank you for your helpful suggestions and please see my reply to Cyanna for teh results

     

    In summary I can

    MD Test Test

    This creates a subdirectory "Test Test"

    When I

    CD Test Test

    The request is rejected

     

    Tuesday, January 22, 2008 12:24 PM
  • For completeness

    When I

    MD Test Test2

    2 subdirectories are created "Test" and "Test2"

    However when I

    MD "Test Test2"

    1 subdirectory is created "Test Test2"

    When I then

    CD "Test Test2"

    The request is rejected

     

    Tuesday, January 22, 2008 12:29 PM
  • try running a "sfc /scannow" from administrator command prompt. I don't really know it works fine for me.

     

    Tuesday, January 22, 2008 1:32 PM
  • Hold on . What is f:? and is it formatted NTFS? You may have a problem if it's an SD card that is formatted Fat16 by mistake. I remember having this problem with an SD card.

    Tuesday, January 22, 2008 1:34 PM
  • Asaertretr,

     

    Many thanks for support and in answer to your questions:

    SFC found no out of integrities

    F: is a Maxtor 300GB SATA I drive on the primary channel in UDMA 6 and has 1 primary NTFS partition

     

    Why I have changed the print outs to drive D: (a Maxtor 250GB IDE drive on 2nd channel)  is that I deleted the partition on Drive F: to remove the long file name that kept crashing MS Explorer (see my other post)

     

    Regards

     

    Tuesday, January 22, 2008 1:59 PM
  •  

    Which Vista sp1 version are you running because you appear to have some core explorer.exe problems.
    Tuesday, January 22, 2008 2:08 PM
  • Build 6001

     

    Tuesday, January 22, 2008 2:13 PM
  •  

    I'm assuming there's a "Webshots Data" folder inside F:\DEREK>

     

    Are you able to try this? Type this command into cmd.

     

    Code Snippet

     

    F:\DEREK>cd webshot*

     

     

    It should change directory to F:\DEREK\webshots data>

     

    Wednesday, January 23, 2008 6:28 PM
  • Apologies. The thing is you need to put the full path between quotation marks.
    "D:\DEREK\Webshots Data".
    If you don't like typing, Vista has this little nifty bonus right click where you hold Shift before you right click and in the right click menu you get several new options like "copy as path" (you can then right click and paste in the command window) and....."open command window here" (that is going to be opened as a standard user command prompt, not an elevated one, in case you need the later.......)
    Wednesday, January 23, 2008 11:50 PM
  • Spaces. The character we love to hate in the command prompt (or is it we hate to love it?).

     

    If you display a directory listing in the DEREK folder with the /x parameter (dir /x), you will see the "short names generated for the non-8dot3 file names". The folder Webshots Data should be named WEBSHO~1 and you can use that name to CD to it (CD WEBSHO~1).

     

    With a little practice, you will be able to translate to these short names on-the-fly and become a command prompt navigation wizard and you won't think twice about c:\progra~1\common~1\micros~1\statio~1 (C:\Program Files\Common Files\microsoft shared\Stationery).

     

    Good luck!

     

    Thursday, January 24, 2008 5:49 AM
  • Cyanna,

     

    I thank you for your response and your hint about "Copy as Path" was very helpful however; I did exactly as you suggested and received exactly the same error message

     

    I agree with you that putting the full path name in the quotes is good practice although is it an absolute requirement? Back in the days before windows (yes I am old enough to have been using computers then) I do not remember that being a requirement but I am getting on a bit and I may be looking at life through rose tinted glasses

     

    The response by Paul, after yours has provided me with a work around although it does not resolve the actual problem

     

    Many thanks for your support as this is the first time I have used this forum and I am very pleased with how helpful everyone is

     

    Derek

     

    Thursday, January 24, 2008 12:56 PM
  • Paul,

     

    Many thanks for the response and a valueable work around, I had never spotted that usage of the "/X" option

     

    I still believe there is an underlying problem though that MS would be sensible to address

     

    I apologise it took a while to respond to you as the links from my alerts stopped working and it has taken a while to find this thread again

     

    Regards
    Thursday, January 24, 2008 1:02 PM
  • Thomas,

     

    Many thanks for reply

     

    I attempted your suggestion and got the following results

     

    B:\>dir /x
     Volume in drive B is WhatisPossible-BackupDisc
     Volume Serial Number is 6857-0787

     Directory of B:\

    24/01/2008  13:15    <DIR>                       data
    21/01/2008  08:39    <DIR>          DRIVEC~1     Drive C
    21/01/2008  08:40    <DIR>          DRIVED~1     Drive D
    19/01/2008  20:12    <DIR>          DRIVEE~1     Drive E
    22/01/2008  08:47    <DIR>          DRIVEH~1     Drive H
    22/01/2008  08:53    <DIR>          DRIVEP~1     Drive P
    23/01/2008  18:14    <DIR>          DRIVES~1     Drive S
    22/01/2008  08:52    <DIR>          DRIVEW~1     Drive W
    19/01/2008  16:04    <DIR>          SNOWWA~1     Snow Wang - Drive C
    24/01/2008  13:16    <DIR>          WEBSHO~1     webshots data
                   0 File(s)              0 bytes
                  10 Dir(s)  229,491,875,840 bytes free

    B:\>cd webshot*
    Invalid directory

    B:\>cd websho~1

    B:\WEBSHO~1>

     

    Using the non 8dot3 version of the command (kindly suggested by Paul) transfers me to the correct directory,  unfortunately using an astrix does not

     

    Regards

    Thursday, January 24, 2008 1:21 PM
  • I am so glad you ask such good questions!
    Because his forum runs on buggy software, the links to the thread are broken in the  alert e-mail. So I had to google to find the post, so I kept googling some more and it suddenly jumped at me, something you had in your very first post:
    "Microsoft(R) Windows DOS
    (C)Copyright Microsoft Corp 1990-2001."

    That is NOT the Vista command prompt, that is old command.com. It doesn't accept long file names! After 8 chars, it inserts a dot. So for any other input than websho~1 it will look at best for websho.*
    The dot is optional if it comes after exactly eight characters! And yes, in 8dot3 you can't have quotes: my music is mymusi~1, and if you have both "my music" and "mymusic", the names are mymusi~1 and mymusi~2 (don't know which one is which though, it was part of the fun with DOS, that and pacman.....)


    Thursday, January 24, 2008 6:02 PM
  • I'm glad you have a workaround, but as you mentioned you still have the problem. Would you try to shorten ThomasLee's suggestion and just do a CD W* in your DEREK folder? Something is definitely strange. Also, if you can rename the folder in Windows Explorer to something without a space, i.e., "WebshotsData", and then change it back to "Webshots Data". I keep thinking there is something you can't see causing the problem (like a leading space, etc.)...

     

    EDIT: I thought of one more thing. In Windows Explorer in the DEREK folder (so that Webshots Data is in the right windowpane, hold down the <shift> key and right click the Webshots Data folder and select "Open Command Window Here". Does a command prompt open in that folder? It will help determine if the problem is with the CD command or something else.

     

    Friday, January 25, 2008 2:17 AM
  • Derek,

     

    If there's "space" within the folder and file name, it's an absolute requirement to quotes the command/syntax. An example such as,

     

    Code Snippet

     

    C:\>cd "C:\Documents and Settings\All Users\Application Data"

     

    becomes

     

    C:\Documents and Settings\All Users\Application Data>

     

     

     

    Or you can also use wildcard (*) such as

     

    Code Snippet

     

    C:\>cd doc*

     

    becomes

     

    C:\Documents and Settings>

     

     

    This method is not foolproof if you've more of the same folder name in the same dir, example;

     

    Document01

    Document02

    Document03

     

    Using the above command, it'll change directory to the top directory such as C:\Document01>

     

     

    You needn't place any quotes between any 8.3 (8dot3) filename, example

     

    Code Snippet

     

    C:\>cd PROGRA~1

     

    becomes

     

    C:\Program Files>

     

     

     

    You can type "cd /?" without quotes in command prompt for help and syntax.

     

    Code Snippet

     

    Displays the name of or changes the current directory.

     

    CHDIR [/D] [drive:][path]
    CHDIR [..]
    CD [/D] [drive:][path]
    CD [..]

     

      ..   Specifies that you want to change to the parent directory.

     

    Type CD drive: to display the current directory in the specified drive.
    Type CD without parameters to display the current drive and directory.

     

    Use the /D switch to change current drive in addition to changing current
    directory for a drive.

     

    If Command Extensions are enabled CHDIR changes as follows:

     

    The current directory string is converted to use the same case as
    the on disk names.  So CD C:\TEMP would actually set the current
    directory to C:\Temp if that is the case on disk.

     

    CHDIR command does not treat spaces as delimiters, so it is possible to
    CD into a subdirectory name that contains a space without surrounding
    the name with quotes.  For example:

     

        cd \winnt\profiles\username\programs\start menu

     

    is the same as:

     

        cd "\winnt\profiles\username\programs\start menu"

     

    which is what you would have to type if extensions were disabled.

     

     

     

    8.3 filename from Wikipedia

    http://en.wikipedia.org/wiki/8.3

     

    Long filename from Wikipedia

    http://en.wikipedia.org/wiki/Long_filename

     

     

    Hope this helps. If it doesn't, maybe Vista SP1 team should get involved too.

     

    Regards,

    Thomas

     

     DerekGCWhite wrote:

    I agree with you that putting the full path name in the quotes is good practice although is it an absolute requirement? Back in the days before windows (yes I am old enough to have been using computers then) I do not remember that being a requirement but I am getting on a bit and I may be looking at life through rose tinted glasses

    Friday, January 25, 2008 7:16 PM
  • Hi Derek,

     

    to me it looks like it is a simple problem, but difficult to find and solve. You somehow managed to replace cmd.exe with command.com. The first one is the real command processor of NT kernel based Windows, the latter one is for compatibility purposes.

    How do you start your command line window? In your first post the first line of your log already shows the problem:

    Microsoft(R) Windows DOS
    (C)Copyright Microsoft Corp 1990-2001.

    C:\USERS\DEREKG~1>

    should actually read

    Microsoft Windows [Version 6.0.6001]

    Copyright (c) 2006 .....

    on Vista SP1 (or 6.0.6000 on plain Vista).

     

    Could you please use the start menu (circle with windows logo) and enter cmd.exe in the search field and hit the enter key. This should bring up the 'real' command processor with a text similar to this

    Microsoft Windows [Version 6.0.6001]

    Copyright (c) 2006 .....

     

    C:\Users\DerekGCWhite>

     

    Everything should work fine here. To switch to 'faulty' behaviour, simply enter command as a command:

    C:\Users\DerekGCWhite>command

     

    In order to find out what is causing the trouble it is necessary to know how you start your command window.

     

    Many Greetings

    Michael

     

    Saturday, January 26, 2008 10:14 AM
  • "You somehow managed to replace cmd.exe with command.com. The first one is the real command processor of NT kernel based Windows, the latter one is for compatibility purposes."

    Yeah, and if he could share on how exactly he accomplished this I know a LOT of people who would be incredibly grateful, as there are 2 things that won't work in Vista no matter what: printer software ante 2007 and DOS programs!

    Maybe if somebody could fix the links in the alert e-mails OPs would actually be able to post back (mail alert link goes to http://forums.microsoft.com/forums instead of http://forums.microsoft.com/TechNet)
    Saturday, January 26, 2008 11:42 AM
  • Derek is having issues posting to this thread and asked me to add the following for him (he is getting logged out at his attempts to reply, which happens to me, too). I delete all my cookies and then sign back in, but if someone has a way that is easier I would love to know what it is.

     

    From Derek:

     

    In the “Run” window if I use:

     

    • CMD then I get the Vista application Command Line window opened
    • COMMAND then I get the old DOS command line window opened

     

    Saturday, January 26, 2008 6:45 PM
  • Weird but true. You can run command.com from the command prompt. You can also toggle between them by specifying which one you want.

     

    Saturday, January 26, 2008 6:57 PM
  •  cyanna wrote:
    "You somehow managed to replace cmd.exe with command.com. The first one is the real command processor of NT kernel based Windows, the latter one is for compatibility purposes."

    Yeah, and if he could share on how exactly he accomplished this I know a LOT of people who would be incredibly grateful, as there are 2 things that won't work in Vista no matter what: printer software ante 2007 and DOS programs!

     

    Cyanna, I had a weird idea, how this could happen, but the description transmitted by Paul Natterfield contradicts the idea:

      HKLM\Software\Microsoft\Command Processor\AutoRun

    has the value

      command.com

     

    Paul Naterfield states that starting cmd.exe gives the correct command processor and starting command.com gives the 'wrong' one. So I assume that DerekCGWhite has the problem with the command window using the link in start menu folder add-on (or whatever the English wording is for the German word 'Zubehör'). This link is configured to start %SystemRoot%\system32\cmd.exe. So probably the Windows subsystem analyzing the link and then starting the application misbehaves.

     

    Someone who has that problem probably could analyze whats going on using Sysinternal's Process Monitor.

     

    Many Greetings

    Michael

    Saturday, January 26, 2008 8:17 PM
  • These toggling can also be done in WinXP and Win2K.

     

     asaertetretr wrote:
    Weird but true. You can run command.com from the command prompt. You can also toggle between them by specifying which one you want.

    Saturday, January 26, 2008 9:10 PM
  •  

    The AutoRun registry for command processor should be empty, unless otherwise required.

     

    Code Snippet

     

    Windows Registry Editor Version 5.00

     

    [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    "AutoRun"=""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]

    "AutoRun"=""

     

    Saturday, January 26, 2008 9:44 PM
  •  Michael Zöllner wrote:

     

     

    Cyanna, I had a weird idea, how this could happen, but the description transmitted by Paul Natterfield contradicts the idea:

     

    <snip>

     

     

    Miachael: I was relaying information from the OP that he sent me via e-mail. No worries on the confusion.

    Monday, January 28, 2008 1:44 AM
  • No never seen that I can get to it both ways...

    Friday, February 8, 2008 12:03 AM
  • I've had the same problem -- since I am a DOS man I am constantly coming up against downloaded files (like music tracks) which have spaces in them -- and I want to move them around in DOS.

     

    The only recourse is to RENAME them via Windows (Explorer), taking out all the spaces.  Then you CAN type the whole name in DOS.

     

    A bit late, three and a half years later, but it seems nobody else had answered, so, in case anyone else is similarly bothered, I have.

     

    Tranmontane, 22/6/11.


    Martyn Green
    Tuesday, June 21, 2011 4:42 PM
  • Hi All,  [SOLVED]

             Try this in command  prompt to access space between folder name... :)

    start "" "d:\folder-name" (if folder shared on same pc)

    start "" "\\networkpcname\shared folder" (if folder shared on network)

    Thanks

    Rohan Rakshith


    Monday, February 24, 2014 5:46 AM