Sample Script: Get today's date
A sample command line batch file to get today's date from the system. I use this mostly to output a log file with today's date (such as the format 2005.1.18.log) from a batch script. If you just want today's date or time, from Windows 2000 or newer call the variable %date% or %time%.
You may need to reorder the variables depending on your time zone and time display format, or if you use this on NT4, etc. This sample script works fine on English Windows 2000 or newer.
::REM *****************************************************
::REM B a t c h P r o g r a m m i n g S a m p l e
::REM from http://www.japan-page.net
::REM (C) 2002 John D. Seaman
::REM Copylefted, and released to the general Internet
::REM community, you may use, modify and release this
::REM at will as long as you retain this header.
::REM *****************************************************
Author is not responsible for accuracy or functionality of these scripts. You are strongly advised to test everything out of production. Not responsible for formatted HDD's, etc. etc.

Sample Script: DNS zone dump utility »
Search