Solved

Converting Windows file names to DOS file names

Posted on 2000-02-17
8
145 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
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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now