July 14, 200620 yr Hi Freinds,I want to make a windows BATCH file that can save Current Date & time inside a TXT file & save the TXT file as somename.txt.......I checked many sites but din't get a clue how to save current DATE & TIME AS a TXT File..Can u pls do this small code for me?? Im aware of the date & time Variables in batch but dunno how to create a tXT file from them..Dunno which is the right section for this but this one seemed the most feasible Thx
July 14, 200620 yr Try this the text file will be saved in the directory that the script ran from@echo OffSet T=%time%set D=%Date%echo %T% - %D% >> TimeDate.txt
July 14, 200620 yr The same only different@ECHO OFFFOR /F "TOKENS=1-3 DELIMS=." %%a IN ("%time%") DO SET hhmmss=%%a>>date.txt echo %date%>>date.txt echo %hhmmss%
July 15, 200620 yr There are may ways to do this. You can even change your prompt and get a directory listing.@echo offprompt $t $ddir > file.txtPrompt will show time and date and the listing of the current directory. File will be saved in same directory.
July 15, 200620 yr Please note that the > character (as in last post) will OVERWRITE the file, if existing before, whilst the >> characters will APPEND to it.There is an even simpler method using a built-in, not widely known, feature of NOTEPAD:http://support.microsoft.com/?kbid=260563jaclaz
Create an account or sign in to comment