Link to home
Start Free TrialLog in
Avatar of Gregg011299
Gregg011299

asked on

Converting Windows file names to DOS file names

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?
Avatar of Member_2_49692
Member_2_49692

space are underscores like for install set me.doc in windows 98 would be like set_me.doc in dos
Avatar of Gregg011299

ASKER

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
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.
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.
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.





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?
ASKER CERTIFIED SOLUTION
Avatar of cookre
cookre
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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