There is no other method (I know of) which will allow you to work with long filenames. File names with (for example) several sequential spaces are legal, but are impossible to process since DOS sees all the spaces as a single delimiter between the characters to either side of the spaces. DOS can't tell the difference between a space and a comma. They are both delimiters. Any time you work with user input, you expose yourself to the same problem. Placing an entire line in the environment won't allow you to process and dissect it, but it at least allows you to store it intact so you can restore it or append to it.
Assume you have a file (named TESTLINE.TXT) with a single line in it
like this:
Test line ,,
End of line.
This would be impossible to process in a batch file. But if we could
create a batch file like this,
SET TESTLINE=Test line ,,
End of line.
it would create an environment variable named TESTLINE that would store
the line intact. To do this, we simply isolate the
particular line in TESTLINE.TXT (if it's the only line, it should be
easy!), create a line fragment containing SET
TESTLINE= and concatenate the two of them with a command like
copy fragment.txt + testline.txt setenv.bat
This would create a SETENV.BAT we could CALL which would place the
line in the environment.
Lost? Look at the site map.
Bad links? Questions? Send me mail.