Discussion Locked

Dos file name details

0 helpful
16 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Running XP Home.
In the command line I am having trouble changing directories. I know that there is a limit to the number of characters ( I thought it was 8) in a file name but I can't remember how to handle it. I am trying to do "cd program files" comes back with "too many parameters" then I try "cd program~" and "cd program*" and get back "invalid file name"
Help please?
Thanks,
Barkley

16 replies

by matherg

From a command prompt on XP you should be able to enter cd program files. If that doesn't work try chdir program files or chdir /d program files.
Hope this helps.

by barkleyc

Out of 7 responses only 1 was correct: Correct answer is: If CMD is used to open the command prompt it will recognize long file names. If COMMAND is used it will not.

by timwalsh

You are correct that there is a limit to the number of characters in a DOS file/folder name, and that it is 8. However, the command prompt environment in WinXP is not true DOS. Therefore it will recognize the long file/folder name

by barkleyc

Out of 7 responses only 1 was correct: Correct answer is: If CMD is used to open the command prompt it will recognize long file names. If COMMAND is used it will not.

by thechas

I opened up a DOS box on my XP system, and it listed full folder names.

In full DOS mode, the truncated folder name is

progra~1

You can check this by running the dir command.

For each subsequent file or folder with the same first 6 characters in a folder, the number increments by 1.

Chas

by barkleyc

Partially correct. Out of 7 responses only 1 was correct: Correct answer is: If CMD is used to open the command prompt it will recognize long file names. If COMMAND is used it will not.

by barkleyc

Out of 7 responses only 1 was correct: Correct answer is: If CMD is used to open the command prompt it will recognize long file names. If COMMAND is used it will not.

by willcomp

What we have here is a syntax problem of sorts. Chas is close but doesn't quite get the cigar.

When you open a DOS box in XP, the default home directory is C:\Documents and Settings\User Name>

Since you are in a subdirectory, not the root directory, a back slash must precede the directory name or DOS will try to find a subdirectory in the same directory where command was entered.

Correct syntax is: CD \program files

Dalton

by barkleyc

Out of 7 responses only 1 was correct: Correct answer is: If CMD is used to open the command prompt it will recognize long file names. If COMMAND is used it will not.

by bobho

The problem is with the space in the Program Files name. The XP shell is thinking that the Files portion is an option due to the space. Any file name or directory name that you use that has a space in it must be enclosed in quotes when operating on it at the shell prompt. So, to change to the Program Files directory you would type:

cd c:\"Program Files".

You could also use the old 8 character carry-over and type:

cd c:\progra~1

which is what a true dos prompt requires (take the 1st 6 characters, truncate the rest and add a ~1, ~2, ~3 etc). The problem here is that if you have more than 1 file or directory that begin with the same 6 characters you need to know which numeral follows the ~. Anyway, w2k/xp allow you to use names greater than 8 chcaracters when at the shell prompt so why not. The only thing different is if a name has spaces in it as shownn above.

Here is a link with more information:

http://www.computerhope.com/issues/ch000209.htm

Cheers,

RW

by barkleyc

Out of 7 responses only 1 was correct: Correct answer is: If CMD is used to open the command prompt it will recognize long file names. If COMMAND is used it will not.

by simy

You can access the command prompt by typing either 'command' or 'cmd' from the run dialog box. If you used 'command', the 8 character filename applies and you would need to type 'cd\progra~1'. If you used 'cmd', long filenames would be recognised and you could type 'cd\program files'.

This discussion is closed to new replies.