Solved

Converting Windows file names to DOS file names

Posted on 2000-02-17
8
150 Views
Last Modified: 2013-12-29
I write some batch files in Win98 that copies files.  I understand how DOS shortens Window file names, but I don't understand how to handle spaces in the Window file name.  Can someone help?
0
Comment
Question by:Gregg011299
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 21

Expert Comment

by:briancassin
ID: 2533044
space are underscores like for install set me.doc in windows 98 would be like set_me.doc in dos
0
 

Author Comment

by:Gregg011299
ID: 2533071
I tried that, but it did not work.  In the mean time, I did some more research and discovered my own answer, which works.
CMDB be.mdb in Win98 becomes CMDBbe~1.mdb in DOS
0
 
LVL 22

Expert Comment

by:cookre
ID: 2533324
If you are computing the short names, don't forget to check any given  proposed short name to see if it already exists.  If it does, you'll have to increment the digit after the ~ and iterate until you get a unique name.  And, if you find 9 duplicates, you have to chop the end of the proposed short base and start into double digits after the ~.

Or, if this is for use in DOS under 95, just put the fully qualified long name in double quotes.  For example:

copy "c:\big long file name.thing"  shrt.dat

works just fine.
0
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 

Expert Comment

by:itssook
ID: 2533463
Instead of using spaces just combine the words and shorten it to 8 characters.

So instead of doing: my word story.doc dos omething like wordstry.doc and that will work.
0
 
LVL 22

Expert Comment

by:cookre
ID: 2533541
itssook:  The convention at EE is to post comments only.  Most folks don't bother looking at questions that have been locked by a proposed answer, thereby denying the questioner extra exposure.  I see you're new here, so don't worry about it - it's a common occurance.





0
 

Author Comment

by:Gregg011299
ID: 2536871
That doesn't answer my question--it is merely a workaround for the situation. I don't want to rename the file since several PC's refer to it and the links would have to be updated.

Cookre gave the most information to date--a questions though.  Does 98SE use the double quotes around the file names just as 95?
0
 
LVL 22

Accepted Solution

by:
cookre earned 50 total points
ID: 2537171
Yup. The sample I gave above I ran on 98 just to make sure.
0
 

Author Comment

by:Gregg011299
ID: 2538259
Cookre -- You got the answer.  I tested it in my batch file and it works.  I thought I tried that before, but guess I didn't.  That's a much better way of handling the situation than the one I came up, so you deserve the points.

Thanks, Gregg
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question