The page: echo.html

Microsoft Windows
Post Reply
jeb
Posts: 12
Joined: 2023-May-10, 1:28 pm

The page: echo.html

Post by jeb »

Hi Simon,

the description on the echo.html can be improved.
A more robust alternative is to separate with : instead of a space.
ECHO:%_department%
This might be more robust, but still not good :-)

It fails for

Code: Select all

set "var=\..\..\..\..\windows\system32\calc.exe"
echo:%var%
The best and only safe echo character version is "echo("
Using Echo:in this way does have some limitations:
If the variable does not exist, ECHO: will return the variable name"%_var%"
This is only true in the command line context, in a batch file this works flawlessly.
It has nothing to do with the "echo:" command, it's only an effect of the different variable expansion rules in the command line context.

jeb
User avatar
Simon Sheppard
Posts: 191
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: The page: echo.html

Post by Simon Sheppard »

OK have updated the ECHO page now, Thanks!
jeb
Posts: 12
Joined: 2023-May-10, 1:28 pm

Re: The page: echo.html

Post by jeb »

Thanks,
but there is still a flaw on the page.
There are some edge cases (such as adding \..\..\..\..\ to a variable) where only ( will work without errors e.g. Echo (%_var%
There is a space between "ECHO" and "(", but there shouldn't.

Better:
... where only "(" will work without errors e.g. ECHO(%var%
User avatar
Simon Sheppard
Posts: 191
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: The page: echo.html

Post by Simon Sheppard »

Ah good catch, I changed that now. Thanks again.
Post Reply