|
| |
.GetLogTimeP
Description
- Displays the current time as hhmnsshs, regardless of the local time format
- Saves the value in #LogTimeP {P
is for Precise}
hh = two-digit hour (01-24)
mn = two-digit minute (01-60) {mm is used for months}
ss = two-digit seconds (01-60)
hs = two-digit hundredth of a second (00-99)
Syntax
At the Command Prompt
|
C:\>. GetLogTimeP |
|
|
|
C:\>%.GetLogTimeP% |
|
|
In a Script
Parameters and Switches
Errorlevels and Output Variables
|
Display to
STDOUT |
|
Value of
#LogTimeP |
|
Error
Level |
|
Description of Result |
|
07053007 |
|
07053007 |
|
n/a |
|
Display current time as
hhmnsshs |
Examples, Notes and Instructions
NT
2K
XP
K3 |
C:\GuardPost>%.GetLogTimeP%
07053007
C:\GuardPost>SET #LogTimeP
#LogTimeP=07053007 |
- Output is displayed to STDOUT
- To suppress console display, use
%.GetLogTimeP% %.Quiet%
{errorlevel and output variable(s) will still be available}
Related .Mount/\Commands, #Constants,
$Functions, :Procedures
|
Resource |
|
Short Description |
|
.GetLogDate |
|
Display current date as yyyymmdd, regardless of the local date format |
|
.GetLogTime |
|
Display current time as hhmnss, regardless of the local time format |
!GuardNotes
How to rename a file using the current time
01. %.GetLogTimeP% %.Quiet%
02.
REN "FileName.ext"
"%#LogTimeP%.ext" |
This will rename FileName.ext to hhmnsshs.ext
|
^
/!\ |
Always put file names "in quotes" to avoid errors when any part of the file name or it's path contain embedded spaces or
reserved characters. |
How to rename a file using the current time and date
01. (%.GetLogTimeP%
& %.GetLogDate%)
%.Quiet%
02. REN
"FileName.ext" "%#LogDate%-%#LogTimeP%.ext" |
How to rename multiple files using the current time and date
01. (%.GetLogTimeP%
& %.GetLogDate%)
%.Quiet%
02. FOR
%%A IN (FileSpec
[...])
DO @(
03.
REN "%%~dpnA"
"%%~dpnA_%#LogDate%-%#LogTimeP%%%~xA"
04. ) |
%%~dpnA = Drive, Path and FileName only (no extension)
%%~xA = Extension only, including the . prefix (".doc")
The above example will append "_yyyymmdd-hhmnsshs" to each filename matching the FileSpec while preserving the
correct extension.
For example, if FileSpec = "*.doc", each file matching *.doc will be renamed to
"OriginalDocumentName_20030101-07053007.doc"
|
K
E
Y |
Common Commands |
INTERNAL |
External |
/SWITCH |
Parameter |
Help text |
AddonTool |
|
Mounted Commands |
.Mount/\Command |
CmdShorthand |
#Constant |
$FUNCTION |
:Procedure |
!GuardNote |
|
Operating Systems |
NT/2K/XP/K3 |
NT Only |
NT/2K |
2K Only |
2K/XP |
XP Only |
XP/K3 |
K3 Only |
2K/XP/K3 |
|