Tip
Subject Content

137
Set an environment variable in Windows 2000

Windows 2000 and XP include most of the commands you're familiar with from DOS and Windows

9x. But when Command Extensions are enabled—as they are by default—many of these commands

gain additional features. The DATE /T switch itself (which causes DATE to return without waiting

for input) is one such added feature.



Fortunately, you don't need to do a single thing to get the current date into an environment

variable. When Command Extensions are enabled, your batch files can access a number of dynamic

environment variables that return various system values. Specifically, the %DATE% and %TIME%

variables return the current date and time. You may also find uses for %CD% (returns the current

directory), %ERRORLEVEL% (returns the exit code of the most recent command) and

%RANDOM% (returns a random number from 0 through 32,767). Type SET /? at a command

prompt for more information.

Page 137 of 237
First Previous Next Last