M2Ktech.com


Bookmark
Page

   TECH FORUM
 
Forum
FORUM
Tips to your desktop
Subscribe to our mailing list:
Email:

Search this site:

<< BACK

PRINT VERSION

Tricking the XP and 2000 Command Prompt to Accept Long File Names

How many of you have ever used the DOS command prompt of Windows 2000 or Windows XP and been old that the file or folder name you entered had "Too Many Parameters"? Even running CD MY DOCUMENTS to get into this most-used folder will cause this. Since these operating systems are supposed to allow file names of up to 255 characters, you might very well have wondered what was going on and if there was an easy way around it. Well, there is.

Windows 95, 98 and Millennium handled the file name problem by creating a second truncated version of any long file names, that follows the DOS rules of only eight characters (no spaces) and a 3-character extension. For instance if you name a file MY REPORT ON BRAIN SURGERY.DOC it will truncate this to MYREPO~1.DOC. A file in the same directory named MY REPORT ON ROCKET SCIENCE would become MYREPO~2.DOC to distinguish its truncated name from the first one. If you run a DIR command you will see both the long and short versions of each name.

However, Windows 2000 and Windows XP have completely eliminated all traces of DOS from the OS kernel, and when you run a DIR command from the XP or 2000 command prompt you will see only the longer file names listed. The default command prompt in those operating systems is only a simulation of DOS but it still won't accept long file names, and therein lies the problem.

Fortunately, it turns out that Microsoft actually created two versions of the command prompt, both of which are included in the program. The default version that won't accept long file names simulates the old COMMAND.EXE. To open the alternate version, go to Start\Run and type in CMD.EXE. Hit Enter and you will see a new DOS Prompt window that does understand long file names.

There is also a shortcut you can use without changing the default command prompt. If your file name has too many characters (or includes spaces), just enclose the name in quotation marks. For example, we can run CD "MY DOCUMENTS" with the default command prompt, no problem.

If the path or file name is very long, rather than typing it all in you can locate it in Windows Explorer. Then right-click and select Copy from the context menu. Next, click on the command line in the DOS window, type in your DOS command followed by a space, and then right-click the mouse. The entire path and file name will be pasted into the command line, and you are good to go.

Yet another solution to one of the fun little quirks of Windows brought to you by your friends at Micro 2000.

Micro-Scope - PC Hardware trouble shooting at your finger tips

Micro2000 PC Diagnostics

Erased the data on your hard drive? Think again!

MicroScope on a Stick





Free translation
   SITEMAP | CONTACT | HOME

Disclaimer - The M2K Tech Tip is a free service providing information only. While we use reasonable care to see that this information is correct, we do not guarantee it for accuracy, completeness or fitness for a particular purpose. M2KTech.com shall not be liable for damages of any kind in connection with the use or misuse of this information.

© 2006 M2Ktech.com All Rights Reserved