|
| |
$ESC (Escapify the contents of a variable)
Description
Reformats the contents of a variable by adding escape characters. This allows CommandSymbols such as
<>|&^() to be manipulated and displayed literally by commands such as ECHO, FOR, etc.
Syntax
At the Command Prompt (library
IS NOT initialized)
|
C:\>NTCmdLib |
$ESC VariableName |
At the Command Prompt (library
IS initialized)
In a Script (library
IS NOT initialized)
|
CALL
NTCmdLib |
$ESC VariableName |
In a Script (library IS
initialized)
Parameters and Switches
| VariableName |
|
The name of the environment variable containing the string to be processed. |
Errorlevels, Output Variables and Custom Mount/\Commands
|
Name |
|
Value |
|
Description/Contents |
|
_ESC |
|
escaped string |
|
The escaped output of VariableName's
contents |
|
ErrorLevel |
|
Description/Contents |
|
0 |
|
Success |
|
2 |
|
Missing or invalid parameter |
Examples, Notes and Instructions
- NTCmdLib $ESC var
if var=<title>Home Page</title>
then _ESC=^<title^>Home
Page^</title^>
- The contents of VariableName CANNOT BE outer quoted. Balanced
inner quotes are OK. For example:
var="<title>Home Page</title>" {IS BAD}
var=<title>"Home Page"</title> {IS OK}
For multiple layers of "escapification", re-call using the previous output:
NTCmdLib $ESC _ESC
{adds a second level of escaping}
Notes
- Output is displayed to STDOUT, errors to STDERR
- To suppress console display, use the library GlobalSwitch /Quiet (or simply /q)
NTCmdLib /Q TaskID /TaskSwitches Parameters
CALL NTCmdLib /Q TaskID /TaskSwitches Parameters
%.Call% /Q TaskID /TaskSwitches Parameters
Related .Mount/\Commands, #Constants,
$Functions, :Procedures
|
Resource |
|
Short Description |
| |
|
|
|
K
E
Y |
Common Commands |
INTERNAL |
External |
/SWITCH |
Parameter |
Help text |
AddonTool |
|
Mounted Commands |
.Mount/\Command |
CmdShorthand |
#Constant |
$FUNCTION |
:Procedure |
!GuardNote |
|
Operating Systems |
NT/2K/XP/K3 |
NT Only |
NT/2K |
2K Only |
2K/XP |
XP Only |
XP/K3 |
K3 Only |
2K/XP/K3 |
|