Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to automatically include the current date in a batch created file


Author: Tristan Lim MVP

View products that this article applies to.

Tips

To use the following DOS command line, you have to include the line into a batch file wherever it makes sense for you.
For example, to create a zip file with the year and month and day as part of the file name:
wzzip %date:~-4,4%%date:~-7,2%%date:~0,2%test.zip
In the above example, I am using Winzip Command Line Add-on.
The above serves as an example on how to make use of simple DOS commands to achieve a what is basically a simple task.
One look on the internet gives you dozens of ways to do that but they all lack one important characteristic; simplicity.

↑ Back to the top


Community solutions content disclaimer

Microsoft corporation and/or its respective suppliers make no representations about the suitability, reliability, or accuracy of the information and related graphics contained herein. All such information and related graphics are provided "as is" without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties and conditions with regard to this information and related graphics, including all implied warranties and conditions of merchantability, fitness for a particular purpose, workmanlike effort, title and non-infringement. You specifically agree that in no event shall Microsoft and/or its suppliers be liable for any direct, indirect, punitive, incidental, special, consequential damages or any damages whatsoever including, without limitation, damages for loss of use, data or profits, arising out of or in any way connected with the use of or inability to use the information and related graphics contained herein, whether based on contract, tort, negligence, strict liability or otherwise, even if Microsoft or any of its suppliers has been advised of the possibility of damages.

↑ Back to the top


Keywords: kb, kbpubmvp, kbpubtypecca, kbpubtypett, kbhowto, KB555314

↑ Back to the top

Article Info
Article ID : 555314
Revision : 1
Created on : 2/14/2017
Published on : 2/14/2017
Exists online : False
Views : 365