windows command line isn't good at short code, but I've used this to rename
window log files on occasion
the first section parses the YYYYMMDD out of %DATE%
and the second section removes the colon/period/spaces out of %TIME% and
then trims the resulting string to just the first 4 characters HHMM.
if run from {something.bat)
REM ## BEGIN SCRIPT FILE
FOR %%A IN (%Date%) DO (
FOR /F "tokens=1-3 delims=/-" %%B in ("%%~A") DO (
SET Today=%%D%%B%%C
)
)
SET RightNow=%Time::=%
SET RightNow=%RightNow:.=%
SET RightNow=%RightNow: =%
SET RightNow=%RightNow:~0,4%
SET fileStamp=%TODAY%.%RIGHTNOW%
REM ## END SCRIPT FILE
which would result something like this
20121008.1506
which could be used in a batch to rename files with a timestamp
rename file.txt file.%timestamp%.txt
--
View this message in context:
http://tomcat.10.n6.nabble.com/gc-log-filename-variables-in-windows-tp4987672p4987678.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]