|
| |
$SCOUNT (String Count)
Description
Count the number of times SubString is contained within String. The search is NOT case sensitive. (AB=ab=Ab).
Syntax
At the Command Prompt (library
IS NOT initialized)
|
C:\>NTCmdLib |
$SCOUNT VariableName1|"String" VariableName2|"SubString" |
At the Command Prompt (library
IS initialized)
|
C:\>L |
$SCOUNT VariableName1|"String" VariableName2|"SubString" |
In a Script (library IS NOT
initialized)
|
CALL
NTCmdLib |
$SCOUNT VariableName1|"String" VariableName2|"SubString" |
In a Script (library IS
initialized)
|
%.Call% |
$SCOUNT VariableName1|"String" VariableName2|"SubString" |
Parameters and Switches
| VariableName1 |
|
Name of a variable containing the String to be searched. |
| "String" |
|
A literal "Quoted String" to be searched. |
| |
|
|
| VariableName2 |
|
Name of a variable containing the SubString to look for. |
| "SubString" |
|
A literal "Quoted Substring" to look for. |
Errorlevels, Output Variables and Custom Mount/\Commands
|
Name |
|
Value |
|
Description/Contents |
|
_SCOUNT |
|
numeric |
|
variable containing the total number of
times that Substring is found within string. If SubString is not found, _SCOUNT=0. |
|
ErrorLevel |
|
Description/Contents |
|
0 |
|
Success |
|
2 |
|
Missing or invalid parameter
Literal String/SubString not quoted |
Examples, Notes and Instructions
Example 1 - Check to see if a folder is in the path
|
NTCmdLib $SCOUNT
path "c:\GuardPost" |
_SCOUNT=0
(not found in path)
_SCOUNT=1 (found once in path)
_SCOUNT=n (found
n times in path)
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 |
|