How to output date to a text file, filename in Windows XP
I have tried many ways of doing this in a batch file, although when outputting to a filename, I get "/" in them, so it can't output it to a text file, I realize they differ, so one which works in XP and Vista / 7 would be handy
E.g. Set FileDate=%date:/=%
开发者_运维技巧
Try this:
I had written it a while ago.
@echo off
setlocal ENABLEDELAYEDEXPANSION
set today=!date:/=-!
set now=!time::=-!
set millis=!now:*.=!
set now=!now:.%millis%=!
echo hello world > my-file-!today!_!now!.txt
精彩评论