The 4DOS command processor for MS-DOS

4dos, batch commands, grub 4 dos, dos 4, ms dos 4

What the @%$@#

I posted a question in this group couple of days ago. Well, I found the
answer myself, by mistake.

Just wanna know if there is any logic behind this one.

If you want to include the percent sign (%) in an environment variable,
all you need to do is to put four (!!!) sequential percent signs one
after another, only one will remain:

set _test=hello%%%%world
echo %_test

will result:
hello%world

me not to know why.

—————————
email: ro…@si1.elex.co.il

.
posted by admin in Uncategorized and have Comment (1)

One Response to “What the @%$@#”

  1. admin says:

    You simply forgot to enclose the variable definition of your SET command
    between backquotes so that it would not get prematurely evaluated:

          set _test=`hello%world

    Execute a simple SET or "SET _TEST "to see the actual contents as they
    are kept in the environment.

    - Hide quoted text — Show quoted text -

    Ronen wrote:

    > I posted a question in this group couple of days ago. Well, I found the
    > answer myself, by mistake.

    > Just wanna know if there is any logic behind this one.

    > If you want to include the percent sign (%) in an environment variable,
    > all you need to do is to put four (!!!) sequential percent signs one
    > after another, only one will remain:

    > set _test=hello%%%%world
    > echo %_test

    > will result:
    > hello%world

    > me not to know why.

     _____________________________________________________________
     Mike Bessy                    JP Software, Inc.
     supp…@jpsoft.com            http://www.jpsoft.com/
     CompuServe 75300,1215         "GO JPSOFT"
     _____________________________________________________________