Howto echo or get file timestamp (date) in command (cmd).bat script By neokrates, written on October 30, 2010: cmd bat snippet. What's a Windows command line statement(s) I can use to get the current datetime in a format that I can put into a filename? I want to have a.bat file that zips up a. Command to get File Timestamp including seconds [Aix 5.3] Shell Programming and Scripting.
Filename timestamp in Windows CMD batch script. I have a batch script that outputs a file, and I'm trying to ensure that each time the script is executed, no existing files are overwritten, so I'm trying to put a timestamp on it. Currently I have this: set stamp=%DATE: /=- %_%TIME: :=- %. But if the time is 1- 9 AM, it gives something like: 1. How can I fix this? I'm using Windows 7, and the output of echo %date% %time% in a command line window is (my clock format for 'short date' is set to display 3- letter months): 0. Sep- 1. 2 9: 0. 6: 2.
Edit: I've been using the following timestamp for a good while now, works well. DATE: /=- %_%TIME: :=- %. It produced a timestamp like: 1. TIME% and %DATE%, then stripping white space. The whitespace was the problem in my original question, really.
- I have a batch script that outputs a file, and I'm trying to ensure that each time the script is executed, no existing files are overwritten, so I'm trying.
- How to get the timestamp of a file on Linux? I know two commands: 'ls -l' and 'stat'. Is there any other command that can get that.
- How can I change the timestamp on a file? [duplicate] up vote 24 down vote favorite. 11. Possible Duplicate: How to modify timestamp in a dll or exe?
Automate your routine Other tasks with the script: Getting current timestamp in batch file. Get answers to your IT programming questions in minutes.