Coder's Guild Mailing List

MS-DOS and Spaces

Posted by Reto F. Bachmann on 2001-04-07

>>Spaces in MS-DOS Name (mas fawzi mohd ali <fawzi-ali@xxx.xxxxxx.xxxxx.xx.xx>)

>>Hi there coders,
>>I'm working on a project right now which is necessary for me to name
>>folders (in MS-DOS) with spaces eg. TM<SPACES>JU. Is there any trick to
>>this? Or should go to the assembly level? I don't even have a clue where to
>>start or which language should I use. I really appreciate anyone who can
>>help me regarding this matter. Thank you in advance for the help.

Hi Ali

FOR NEWER OSes (like NT 4 or Win 95):
you can simply use "" around the path to include spaces in path or file
names.
e.g.  MD "A B" will create a Folder C:\A B (observe the space)

OLDER OSes (like DOS 3.3. / DOS 5.0 etc.):
i don't think spaces is a good idea in MS-DOS file or folder names, as
this
was strictly a 'special character' for file names in 'the old days'.
Think
of it like the (undocumented) possibility to have _folders_ with 8.3
names:
it may work in some situations but it WILL fail in others (i.e. does DIR
and
RM and xy ...... _all_ still work?)

i suggest you use the underscore '_' instead as this is very common.

IF (you have your reasons...) you HAVE to use Spaces, then you will have
to
handle everything yourself as (how mentioned above) the other internal
(COMMAND.COM) or external Commands might/will have problems with spaces.

if only your program handles the data, OK, but do other programs have to
handle it? even a simple COPY or so could fail.....

the language you use then should be quite low level, C or Assembly will
do OK, but it might be _NO_ fun at all parsing through the FAT looking
for file names with spaces :-( 

So, it will be helpful if you could post the exact version of MS-DOS it
should/will run under and maybe some other details of the project like
'only my program will access the file' or 'no, i can not convince the
boss of not using spaces' etc. etc.

HTH
Reti 

alfasoft communications GmbH
Postfach 1532
CH-4800 Zofingen Switzerland
Tel. +41 (0) 62 / 752 22 22
Fax. +41 (0) 62 / 752 52 09
http://www.alfasoft.ch
mailto:bachmann@xxxxxxxx.xx