Tuesday, August 6, 2013

Using Quotes in Batch Files

It is likely that using quotes is a hard topic for everyone who strats learning batch programming. We'll try to clarify this question a bit.
Quotes is just the way to pass the parameters containing spaces. Let's see an example:
DIR c:\Program Files
It seems that it's all right, and we'll list files and folders from Program Files directory. But this is wrong opinion because the space in batch files is delimiter for parameters passing to the batch command.To pass the single argument to the DIR command you should quote it:
DIR "c:\Program Files"
Quotes is not the part of the folder name. They only let the command know that space is the part of this name.
We kindly remind that Dr.Batcher is the best program to create batch file, both .BAT and .CMD, try it if haven't tried it yet. 

No comments:

Post a Comment