Hi fellow users :-)

I have been wondering which chars are special in SET
in FreeCOM and whether they can be escaped or similar.

As with most DOS commands, < | > are normally special.
Any other characters which tend to be special in shells
seem to be okay in SET. So far for the good news. But:

You can do SET KEY=VALUE as expected as long as none
of the 3 special chars are in there.

You can also use double quotes in surprising ways:

SET KEY="VALUE allows you to use any character in
the value, but the double quotes will become part
of the value. You do not need closing quotes and
you can use more quotes anywhere in the value.

SET "KEY=VALUE however is sort of evil, check this:

>SET "KEY=value<foo>bar|stuff
>echo %KEY%
ECHO is on
>echo "%KEY%
ECHO is on
>echo %"KEY%
Cannot redirect input from file "foo"
>SET | tail -1
"KEY=value<foo>bar|stuff

>set "KEY=value|dir
>echo %"KEY%
... will run the DIR command!

I guess you can use this either as a feature or as
a nasty security hole. Again, you can safely use

>set KEY="value|dir
>echo %key%
"value|dir

but that will always have the " as a part of the value.

Are there other ways to deal with < | > in SET commands
and then use the values in ECHO and other commands?

Regards, Eric



PS: Tests done in DOSEMU2, but with classic FreeCOM installed:
C:\>ver /r

FreeCom version 0.84-pre2 XMS_Swap [Aug 28 2006 00:32:15]
DOS Version 6.22
FreeDOS kernel build 2038 [version May 16, 2009 compiled May 16 2009]



_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to