Article ID: 65163 - View products that this article applies to.
This article was previously published under Q65163
Although your application program may allow you to enter a filename or directory name that contains a space character, MS-DOS does not allow filenames or directory names to have spaces in them.
If you create a filename containing a space, you cannot subsequently remove, load, or delete the file unless you first rename it.
For example, if the file appears in the directory as
then MS-DOS does not allow you to manipulate the file unless you delete the space between "TEST" and "CAR."
TEST CAR TXT 4098 01-01-80 3:10pm
If you create a directory name with a space in it, you must remove the directory.
When MS-DOS parses the command line, it separates the various parameters by looking for a space. MS-DOS commands and utilities view the filename "AUG 1990.DAT" as two parameters: "AUG" and "1990.DAT." Commands such as ERASE, COPY, and RENAME return an invalid parameter error because it appears that an extra parameter is supplied.
Also, certain operations that application software can request MS-DOS to perform require a filename. If the filename supplied to MS-DOS by the application contains a space, MS-DOS may be unable to process the request.
Modifying/Removing a FileUse the following procedure to rename and then modify a file with a space in its name:
Removing a DirectoryYou can remove a directory that contains a space in its name by using the Basic interpreter, which is included in MS-DOS (GW-Basic, BASICA, or QBasic).
move "my work" my_work
The user's guides for all Microsoft MS-DOS versions contain a section on valid MS-DOS filenames.
"Microsoft MS-DOS User's Guide and User's Reference version 4.0," page 16
"Microsoft MS-DOS User's Guide and Reference version 5.0," page 69
"Microsoft MS-DOS User's Guide versions 6.0-6.21," page 35
"Microsoft MS-DOS Upgrade User's Guide version 6.22," page 35
Article ID: 65163 - Last Review: May 12, 2003 - Revision: 2.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.