@SAFEENV — Returns the value of an environment variable, replacing any dangerous characters with “safe” equivalents.

Syntax:
%@SAFEENV[var]

var:the name of an environment variable

input Type some text: %%text
set text=%@safeenv[text]
echo You typed "%text".
 

This function is useful with commands such as INPUT or DO var IN @file, which stash text directly in an environment variable without first passing it through the command parser. Do not type a percent sign before the variable name. If you do, TCC’s parser will expand the variable before @SAFEENV ever sees it.

Note: This function only reads text from environment variables, not from internal variables, functions, or array elements. For anything other than an environment variable, use @SAFEEXP instead.

Note: If you want to use this function in conjunction with the FOR command, be aware that FOR only stores its control variable in the environment if the variable name is more than one character long.