At the end of a batch file that I run once per week, I want it to copy a
file called Updated<today's date>.txt into a folder that I specify.
<today's date> must be the actual date that my batch was run, in this
format: 20030905
Under Windows NT/2K/XP/K3, this can be done in two self-documenting lines of
code using
Mount/\Commands.
%.GetLogDate%
COPY Updated%#LogDate%.txt DestinationFolder
*******
..GetLogDate CONSISTENTLY displays the date as yyyymmdd, regardless of the
local date format. This value is also saved to variable %#LogDate% and is
always 8 digits. For a color-keyed example, see
(
http://TheSystemGuard.com/MtCmds/GetValue/GetLogDate.htm)
*******
GetLogDate is part of the .GetValue Series of Mount/\Commands.
Some other Get[Value] commands are:
GetLogTime (hhmnss)
GetIPAddr (nnn.nnn.nnn.nnn)
GetMac (xx-xx-xx-xx-xx-xx)
GetFree (free space on current drive in bytes)
GetRole (Server/Wkstn)
Each one displays to the console AND saves the value to a variable for
further processing. Examples at (
http://TheSystemGuard.com/MtCmds/GetValue)
*******
Notes:
1. .Mount/\Commands are constructed using ONLY builtin
commands common to all four platforms (NT/2K/XP/K3).
There is NO BINARY CODE, only scripting commands!
2. .M/\C's are NOT case sensitive. Mixed case is used
for visual clarity only.
3. The (FREE) Advanced NT/2K/XP Command Library (ntlib.cmd)
provides over 50 sample Mount/\Commands to assist with
writing and documenting cross-platform scripts.
You can obtain it at
http://ntlib.com.
*******
-tsg
____________________________________________________________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!