Can't list long filenames in MSDOS?
Infopackets Reader Brad B. writes:
" Dear Dennis,
I would like to create a text document which contains a list of my files in a directory. I asked a techie friend of mine how to do it, and he told me to open up an MS DOS Window and use the command: 'dir *.* > list.txt' I did that but my file names aren't showing up in full. Can you help?"
Side note: MS DOS is the predecessor to Windows. The MS DOS prompt provides an optional way to access or modify files through a command line interface. An MS DOS command prompt can be opened by clicking Start -> Programs -> MSDOS, or if you own Windows 2000 or XP, it's Start -> Programs -> Accessories -> Command Prompt.
My response:
Your tech friend was close to getting you on the right track. The command you listed above essentially says "give me a listing of all files in this folder [using the default format] and output the listing to a text file called list.txt".
Before the release of Windows, MS DOS would only list filenames with a maximum of 8 characters, followed by an extension having 3 characters. To overcome this barrier, Microsoft introduced long filename support, permitting filenames up to 255 characters in length.
When a long filename is listed under MS DOS, its format changes. For example, a filename called "mydocument.doc" under Windows may look like "mydocu~1.doc" under MS DOS. This is because (by default) MS DOS can only display 8 characters with a 3 letter extension.
RE: How to list long filenames using MS DOS
To make the 'dir' command print long file names, you need to insert a /n command switch. This tells the 'dir' command to output files using the new long filename format. All together, the command is:
dir /n >list.txt
Side note: You may notice that I omitted the *.* portion of the command. By default, the 'dir' command will infer that you are listing all files in the directory, so the *.* wildcard is not necessary. Wildcards are particularly useful when specifying search criteria (for example: *.doc, which would list only .doc files in the current directory).
If do not want the 'dir' command to output the date stamps for each file, consider using the /b switch. It provides a "bare" listing that outputs only the filenames:
dir /n /b >list.txt
And, if you want to list all the command switches for the 'dir' command, try:
dir /?
Good luck!
Most popular articles
- Which Processor is Better: Intel or AMD? - Explained
- How to Prevent Ransomware in 2018 - 10 Steps
- 5 Best Anti Ransomware Software Free
- How to Fix: Computer / Network Infected with Ransomware (10 Steps)
- How to Fix: Your Computer is Infected, Call This Number (Scam)
- Scammed by Informatico Experts? Here's What to Do
- Scammed by Smart PC Experts? Here's What to Do
- Scammed by Right PC Experts? Here's What to Do
- Scammed by PC / Web Network Experts? Here's What to Do
- How to Fix: Windows Update Won't Update
- Explained: Do I need a VPN? Are VPNs Safe for Online Banking?
- Explained: VPN vs Proxy; What's the Difference?
- Explained: Difference Between VPN Server and VPN (Service)
- Forgot Password? How to: Reset Any Password: Windows Vista, 7, 8, 10
- How to: Use a Firewall to Block Full Screen Ads on Android
- Explained: Absolute Best way to Limit Data on Android
- Explained: Difference Between Dark Web, Deep Net, Darknet and More
- Explained: If I Reset Windows 10 will it Remove Malware?
My name is Dennis Faas and I am a senior systems administrator and IT technical analyst specializing in cyber crimes (sextortion / blackmail / tech support scams) with over 30 years experience; I also run this website! If you need technical assistance , I can help. Click here to email me now; optionally, you can review my resume here. You can also read how I can fix your computer over the Internet (also includes user reviews).
We are BBB Accredited
We are BBB accredited (A+ rating), celebrating 21 years of excellence! Click to view our rating on the BBB.