Solved

Converting Windows file names to DOS file names

Posted on 2000-02-17
8
151 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 

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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Configuring Remote Assistance for use with SCCM
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.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

728 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