<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Logs Named By Current DateTime</title><link>http://blogs.msdn.com/b/ben/archive/2009/10/02/logs-named-by-current-datetime.aspx</link><description>I have a scheduled task and I’d like to save logs from the output. After some quick batch file work, I came up with this. @echo off setlocal for /f &amp;quot;tokens=2&amp;quot; %%A in ('date /t') DO @(set MyDate=%%A) set MyDate=%MyDate:/=-% set MyTime=%TIME:</description><dc:language>en</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Logs Named By Current DateTime</title><link>http://blogs.msdn.com/b/ben/archive/2009/10/02/logs-named-by-current-datetime.aspx#10075366</link><pubDate>Wed, 13 Oct 2010 15:42:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10075366</guid><dc:creator>RLapinski</dc:creator><description>&lt;p&gt;You could also use undocumented environment variables: %date% and %time% and some string extraction techniques. Those variables are updated by system in real-time so all you need it&amp;#39;s just to use them. Because of this you may want also to use additional variable to assign your filename string due to the they may change during script executions (if you use them multiple times).&lt;/p&gt;
&lt;p&gt;And it also depends on regional settings (in Your example also).&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s simple example (I&amp;#39;m using it in my scripts):&lt;/p&gt;
&lt;p&gt;(for English US) echo %date:~10,4%%date:~4,2%%date:~7,2%_%time:~0,2%%time:~3,2%&lt;/p&gt;
&lt;p&gt;Example output: 20101013_1734&lt;/p&gt;
&lt;p&gt;(for English UK) echo %date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%&lt;/p&gt;
&lt;p&gt;Example output: 20101013_1734&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;Greetings,&lt;/p&gt;
&lt;p&gt;Robert&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10075366" width="1" height="1"&gt;</description></item></channel></rss>