guard
December 6th 03, 02:55 PM
"LES" wrote
> In DOS(XP version) anyone know how I can append the name of a folder with
> the current date
> myfolder ---> myfolder9-23-03
* THIS IS AN NT/2K/XP/K3 Specific Answer *
The .Mount/\Command ".GetLogDate" will CONSISTENTLY display the date as
"yyyymmdd" under NT/2K/XP/K3 regardless of the local date format using no
external utilities. The value is also saved to variable "#LogDate".
In your specific case, the syntax would be:
%.GetLogDate%
REN "myfolder" "myfolder%#LogDate%"
The above renames "myfolder" to "myfolder20030923". This format is easier
to sort.
*******
If you really need the requested format of m-dd-yy, rearrange the #LogDate
to your format by replacing %#LogDate% with
%#logdate:~5,1%-%#logdate:~0,2%-%#logdate:~2,2%
*******
Be aware that for the months of October, November and December, you will
need
%#logdate:~4,2%-%#logdate:~0,2%-%#logdate:~2,2%
so that two digits are present for months 10,11 and 12.
*******
Once again, for a CONSISTENT output, the yyyymmdd format is highly
recommended.
For a color-keyed example, see
(http://TheSystemGuard.com/MtCmds/GetValue/GetLogDate.htm).
*******
Notes:
1. .Mount/\Commands are constructed using ONLY builtin
commands common to all four platforms (NT/2K/XP/K3).
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 RELIABLE cross-platform scripts.
You can obtain it (for FREE) at http://ntlib.com.
*******
TheGuardBook contains a "Mounted Help" page for each internal cmd.exe
command. This is a single color-coded page, highlighting the differences
among the NT/2K/XP/K3 versions. The complete help text for each OS is also
available for comparison (http://TheSystemGuard.com/TheGuardBook/CCS-Int).
*******
-tsg
__________________________________________________ __________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!
> In DOS(XP version) anyone know how I can append the name of a folder with
> the current date
> myfolder ---> myfolder9-23-03
* THIS IS AN NT/2K/XP/K3 Specific Answer *
The .Mount/\Command ".GetLogDate" will CONSISTENTLY display the date as
"yyyymmdd" under NT/2K/XP/K3 regardless of the local date format using no
external utilities. The value is also saved to variable "#LogDate".
In your specific case, the syntax would be:
%.GetLogDate%
REN "myfolder" "myfolder%#LogDate%"
The above renames "myfolder" to "myfolder20030923". This format is easier
to sort.
*******
If you really need the requested format of m-dd-yy, rearrange the #LogDate
to your format by replacing %#LogDate% with
%#logdate:~5,1%-%#logdate:~0,2%-%#logdate:~2,2%
*******
Be aware that for the months of October, November and December, you will
need
%#logdate:~4,2%-%#logdate:~0,2%-%#logdate:~2,2%
so that two digits are present for months 10,11 and 12.
*******
Once again, for a CONSISTENT output, the yyyymmdd format is highly
recommended.
For a color-keyed example, see
(http://TheSystemGuard.com/MtCmds/GetValue/GetLogDate.htm).
*******
Notes:
1. .Mount/\Commands are constructed using ONLY builtin
commands common to all four platforms (NT/2K/XP/K3).
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 RELIABLE cross-platform scripts.
You can obtain it (for FREE) at http://ntlib.com.
*******
TheGuardBook contains a "Mounted Help" page for each internal cmd.exe
command. This is a single color-coded page, highlighting the differences
among the NT/2K/XP/K3 versions. The complete help text for each OS is also
available for comparison (http://TheSystemGuard.com/TheGuardBook/CCS-Int).
*******
-tsg
__________________________________________________ __________
TheSystemGuard.com | BoomingOrFuming.com | MountCommands.com
Free and "Almost Free" Knowledge for Windows System Admins!