{"id":1210,"date":"2013-10-30T14:10:04","date_gmt":"2013-10-30T12:10:04","guid":{"rendered":"http:\/\/hen.co.za\/blog\/?p=1210"},"modified":"2013-10-31T15:23:43","modified_gmt":"2013-10-31T13:23:43","slug":"command-line-and-strings","status":"publish","type":"post","link":"https:\/\/hen.co.za\/blog\/2013\/10\/command-line-and-strings\/","title":{"rendered":"Command line and strings"},"content":{"rendered":"<p>I&#8217;ve blogged about this some time ago under another topic (<a title=\"creating-daily-log-files\" href=\"http:\/\/https:\/\/hen.co.za\/blog\/2012\/01\/creating-daily-log-files\/\" target=\"_blank\">Creating-daily-log-files<\/a>) but I find myself regularly searching for it again when I have to create a new batch file for something plus have to output some uniquely named log file.<\/p>\n<h1>Situation:<\/h1>\n<p>You have some script\/batch file that does some stuff\/maintenance\/imports whatever. It runs from some kind of scheduler unattended so you need to have it generate a log file in case there were errors\/issues. Creating an output log file is fairly easy but having it create a new name each day\/time is a bit more tricky.<\/p>\n<h1>Possible solution:<\/h1>\n<p>This script assumes a date time format of yyyy\/mm\/dd<\/p>\n<p style=\"padding-left: 30px;\">SET UNIQUESTR=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%<br \/>\nMyTool.exe &gt; MyTool%UNIQUESTR%.log<\/p>\n<p>This will create a log file with a date and time stamp each time it is run (assuming you don&#8217;t run it twice in the same second)<\/p>\n<p>Have fun kids!<\/p>\n<p>Update: a nice site with some helpful info -&gt; <a title=\"dostips\" href=\"http:\/\/www.dostips.com\/DosCommandIndex.php\" target=\"_blank\">http:\/\/www.dostips.com\/DosCommandIndex.php <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve blogged about this some time ago under another topic (Creating-daily-log-files) but I find myself regularly searching for it again when I have to create a new batch file for something plus have to output some uniquely named log file. &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/hen.co.za\/blog\/2013\/10\/command-line-and-strings\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,16],"tags":[111,112,216],"class_list":["post-1210","post","type-post","status-publish","format-standard","hentry","category-development","category-reference","tag-command-line","tag-dos","tag-script"],"_links":{"self":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/comments?post=1210"}],"version-history":[{"count":4,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1210\/revisions"}],"predecessor-version":[{"id":1216,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/posts\/1210\/revisions\/1216"}],"wp:attachment":[{"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/media?parent=1210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/categories?post=1210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hen.co.za\/blog\/wp-json\/wp\/v2\/tags?post=1210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}