# Quotation marks in batch files



## leb (Jan 30, 2004)

After much experimentation, I have just discovered that one can write DOS batch files which reference long file names - even those which include spaces - simply by putting the file (or directory) names in quotation marks. The batch files will then execute flawlessly. What I am curious about, however, is how this solution can possibly exist. When DOS was written, no one even knew about long file names or file/directory names with spaces. How then could simply putting a file/directory in quotation marks correct a problem which did not even exist when the system was created? I am thrilled to find a solution to my problem of writing batch files to back up my data however however it seems counterintuitive that putting quotation marks around a file causes the system to recognize something which did not exist at the time the system (DOS) was created. I can't figure this one. Any insights?

Lois B.


----------



## kiwiguy (Aug 17, 2003)

What version of DOS are you using though.

The ability to recognise LFNs was built into system DOS underlying the later Windows OS's.

LFNDOS.EXE allows the use from about DOS 3.3 onwards

Remember if you are using DOS under Windows, you might not even be in real DOS, only a Windows emulator. Depends on your Windows version.


----------



## leb (Jan 30, 2004)

Well, I believe that would explain the curious phenomenon. If the ability to recognize the long file names was built into the system then it was simply a matter of finding the correct means to make it happen ie. the quotes - I am using the version of dos which comes with w2k


----------



## kiwiguy (Aug 17, 2003)

There isn't any (real) DOS with Windows 2000.

DOS under W2k is a "DOS emulator" running under Windows...


----------



## leb (Jan 30, 2004)

This information is very helpful and makes perfect sense. I can see where the phenomenon is not anachronistic at all. Why did they put in this dos emulator - was it for such occasions as I used it i.e. to create batch files or to run programs from a command prompt? I tried all possible ways to get the batch files to run until a google search revealed that I needed to put the file names in quotes. I was really glad because batch files are extremely useful when it comes to backing up data which is buried several directories deep and which is associated with long file names. Sometimes you simply can not change a directory or file name because the program will not then recognize the data you need. I appreciate all this help. The phenomenon of using quotes makes no sense if you think you are using the traditional dos but it makes perfect sense as you have explained it. I would have to assume then that if one were running the "old" dos on an older operating system, then putting file names in quotes would NOT work - thanks again to both you and the others who took the time to explain this puzzeling phenomenon


----------



## kiwiguy (Aug 17, 2003)

I too use DOS batch files for automated backups under Windows XP. I started with DOS 1.0, in 1981...


----------



## jfarc (Mar 21, 2004)

>>> kiwiguy: I too use DOS batch files for automated backups under Windows XP. I started with DOS 1.0, in 1981... <<<

Then you should remember 'Turbo-DOS'... woohoo.

JohnF


----------

