----^--->
/\

//\\
//The\
/Sy
stem\
////
Guard
\

In the mount of the LORD it shall be seen. Genesis 22:14

SwitchesList

Booming Or Fuming? | MasterCatalog | ntlib (FREE) | NTCmdLib | MtCmds | Scripts | Almost Free | TheGuardBook | Help

 

Types of
.Mount/\Commands

.CrystalClear | .ExactName | .ExitELn | .GetValue | .ifCondition | .ifELn | .IsPattern | .ListValue | .NetValue | .NowValue | .RedirRapids | .ReliableReporting | .RestoreValue | .SetELn | .ValueEcho

CrystalClear
Series

  AppendTempFile | Call | CheckTempFile | ClearTempFile | DeleteMe | DeleteTempFile | ForAll | ForExpand | HideComments | HideTempFile | MarkTempFile | ReadTempFile | Rem | ShowComments | ShowTempFile | SortTempFile | SwitchesList | TouchTempFile | Wait | WriteTempFile

.SwitchesList

Description

    Display the current TRUE/FALSE state of all .if/Switch and .ifNot/Switch Mount/\Commands.

Syntax

%.SwitchesList%    

Parameters and Switches

%.if/Switch%

  A command which, if it exists, is displayed

%.ifNot/Switch%

  A command which, if it exists, is displayed

Errorlevels and Output Variables

none

           

Examples, Notes and Instructions

  • The ifELn series is NOT INCLUDED in the output of .SwitchesList.  Only commands like if/Switch and ifNot/Switch are shown.
  • To display the current status of ifCondition Series Mt/\Cmds like .ifNT and .ifServer, use ".Stat".
  • To process switches from the command line, see the :Parse_Command_Line_Switches procedure.
  • The following five commands create and manipulate switches:
.SwitchesList Displays the TRUE/FALSE status of any existing switches. Used primarily as a tool for understanding.
.SwitchesOFF Turns OFF any switches specified in the variable %switches%.  Turning off switch s1 means that .if/s1 will evaluate to FALSE and .ifNot/s1 will evaluate to TRUE.
.SwitchesON Turns ON any switches specified in the variable %switches%.  Turning on switch s1 means that .if/s1 will evaluate to TRUE and .ifNot/s1 will evaluate to FALSE.
.SwitchesReset This will clear all switches from memory.  Do not use any .if/switch commands after SwitchesReset as they are all now set to NUL.
.SwitchesToggle Toggles the state of switches specified in the variable %switches%.  Toggling switch s1 means that if .if/s1 was TRUE it will now be false, and vice versa.  The .ifNot/s1 command will be similarly affected.

Example 1 - Understanding the if/switch commands, interactive demo.

NT
2K
XP
K3
C:\GuardPost>NTCmdLib /init /quiet

C:\GuardPost>. SwitchesList
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------

C:\GuardPost> SET "switches=s1 s2"

C:\GuardPost>. SwitchesON

C:\GuardPost>. SwitchesList
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------
True	.if/s1
True	.if/s2
False	.ifNot/s1
False	.ifNot/s2

C:\GuardPost> SET "switches=s3 s4"

C:\GuardPost>. SwitchesOFF

C:\GuardPost>. SwitchesList
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------
True	.if/s1
True	.if/s2
False	.if/s3
False	.if/s4
False	.ifNot/s1
False	.ifNot/s2
True	.ifNot/s3
True	.ifNot/s4

C:\GuardPost> SET "switches=s1 s3 s5"

C:\GuardPost>. SwitchesToggle

C:\GuardPost>. SwitchesList
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------
False	.if/s1
True	.if/s2
True	.if/s3
False	.if/s4
True	.ifNot/s1
False	.ifNot/s2
False	.ifNot/s3
True	.ifNot/s4

C:\GuardPost>. SwitchesReset

C:\GuardPost>. SwitchesList
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------

C:\GuardPost>

Example 2 - Multiple commands on one line - in a script

The contents of the switches variable are dynamically expanded, enabling multiple commands to be safely placed on one line.

Switches_Demo.cmd

01. @ECHO OFF
02. SETLOCAL ENABLEEXTENSIONS
03.
%.SwitchesReset%
04. (SET "switches=a b") & (
%.SwitchesOn%)     & %.SwitchesList%
05. (SET "switches=c d") & (
%.SwitchesOff%)    & %.SwitchesList%
06. (SET "switches=c")   & (%.SwitchesToggle%) & %.SwitchesList%
07. ENDLOCAL

NT
2K
XP
K3
C:\GuardPost>NTCmdLib /init /quiet

C:\GuardPost>Switches_Demo
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------
True	.if/a
True	.if/b
False	.ifNot/a
False	.ifNot/b
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------
True	.if/a
True	.if/b
False	.if/c
False	.if/d
False	.ifNot/a
False	.ifNot/b
True	.ifNot/c
True	.ifNot/d
Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------
True	.if/a
True	.if/b
True	.if/c
False	.if/d
False	.ifNot/a
False	.ifNot/b
False	.ifNot/c
True	.ifNot/d

C:\GuardPost>Current Status of Switch .Mount/\Commands
-------------------------------------------------------------------------------

C:\GuardPost>

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

CrystalClear
Series

  AppendTempFile | Call | CheckTempFile | ClearTempFile | DeleteMe | DeleteTempFile | ForAll | ForExpand | HideComments | HideTempFile | MarkTempFile | ReadTempFile | Rem | ShowComments | ShowTempFile | SortTempFile | SwitchesList | TouchTempFile | Wait | WriteTempFile
/\
//\\
//
The\
/Sy
stem\
////
Guard
\
COME ON UP WITH US!
and
Congratulations On Your Decision
to
RISE ABOVE
THE REST!

^
/
!\
/LIB\

TheSystemGuard.com [Revised: 2007-03-29]
Copyright © 1995-2007, JWC
Computer Communications,
All Rights Reserved, Worldwide.
 Disclaimer       Privacy       About Us       More


Communication Is Business!

We Master It With Knowledge!

^
/
.\
/M^C\