Skip navigation

JSI Tip 3239. Windows 2000 has some hidden environment variables?

When Command Extension are enabled, which is the default, Windows 2000 defines several environment variables that are hidden, they do not display when you type SET.

These variables are computed dynamically, each time you use them.

NOTE: If a user defines a variable by one of these names, it overrides the default definition.

The dynamic variables are:

 Variable 

 D e s c r i p t i o n 
 %CD% 

 Expands to the current directory. If your current folder is %USERPROFILE%\My Documents,
@echo %CD% might display C:\Documents and Settings\Jerry\My Documents.
 

 %DATE% 

 Expands to the same output as typing DATE. 

 %TIME% 

 Expands to the same output as typing TIME. 

 %RANDOM% 

 Generates a random integer in the range of 0 - 32767. 

 %ERRORLEVEL% 

 Expands to the current ERRORLEVEL. 

 %CMDEXTVERSION% 

 Expands to the current Command Processor Extensions version number. 

 %CMDCMDLINE% 

 Expands to the original command line that invoked the Command Processor. 


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish