Dos - Dynamic Variable

Card Puncher Data Processing


Dynamic Variable are managed by the interpreter in order to give access to environment variable but they are not variable in the way that you can't set them in order to change their value.


  • %CD%: the current directory
  • %errorlevel%: the actual exit code
  • %DATE% - expands to current date using same format as DATE command.
  • %TIME% - expands to current time using same format as TIME command.
  • %RANDOM% - expands to a random decimal number between 0 and 32767.
  • %CMDEXTVERSION% - expands to the current Command Processor Extensions version number.
  • %CMDCMDLINE% - expands to the original command line that invoked the Command Processor.
  • %HIGHESTNUMANODENUMBER% - expands to the highest NUMA node number on this machine.

Discover More
Card Puncher Data Processing
DOS ErrorLevel - How to manage errors with the exit code ?

This article shows you how to manage error handling with the exit code of DOS. In dos: When the errorlevel is: * = 0, then No Error occurred * > 0, then an error occurred You can test if with...
Card Puncher Data Processing
Dos - (CMD|Interpreter) Version

To get the version of cmd, the interpreter, you can use the dynamic variable %CMDEXTVERSION%.
Card Puncher Data Processing
Dos - Directory

Directory in DOS By using the dynamic variable cd, you can retrieve the (working|current) directory Recursively and silently
Card Puncher Data Processing
Dos - If

To get more help on the if statement, type on the command line prompt: where: syntax is a When using the else construct: The command needs to be terminated by a newline or the block command...
Card Puncher Data Processing
Dos - Interpreter

A batch script is interpreted by: or cmd.exe To get the interpreter location, use the variable ComSpec: or the dynamic variable %CMDCMDLINE%

Share this page:
Follow us:
Task Runner