Options
Date/Time in a batch file
Devilsbane
Member Posts: 4,214 ■■■■■■■■□□
in Off-Topic
I'm writing a batch file, which I want to email to someone and have them run it. Once run, I want it to collect a bunch of information and save it to a file, and then copy that file to my computer.
One of the things I want is a date and time stamp at the bottom, but once the date command gets run, nothing else happens because the program is expecting me to enter a new date.
Is there another way around this, either a way to force the computer to skip that part or maybe a different command that gets me what I need?
Thanks
One of the things I want is a date and time stamp at the bottom, but once the date command gets run, nothing else happens because the program is expecting me to enter a new date.
Is there another way around this, either a way to force the computer to skip that part or maybe a different command that gets me what I need?
Thanks
Decide what to be and go be it.
Comments
-
OptionsDevilsbane Member Posts: 4,214 ■■■■■■■■□□Nevermind, I can just use echo %date% and echo %time%Decide what to be and go be it.
-
Optionsundomiel Member Posts: 2,818date /t will get you the current date without asking to reset it.
%date% and %time% would probably be better to use though.Jumping on the IT blogging band wagon -- http://www.jefferyland.com/ -
Optionsbrad- Member Posts: 1,218If it is acceptable, you could just rename the file with the datestamp:
copy c:\filename c:\filename_%date:~4,2%_%date:~7,2%_%date:~10,4%.txt