mehargags Posted July 14, 2006 Posted July 14, 2006 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
gunsmokingman Posted July 14, 2006 Posted July 14, 2006 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
jaws75 Posted July 14, 2006 Posted July 14, 2006 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%
Gee Posted July 15, 2006 Posted July 15, 2006 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.
jaclaz Posted July 15, 2006 Posted July 15, 2006 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now