Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   Generating files MSDOS Batch (http://www.programmingforums.org/showthread.php?t=4149)

wmennai May 28th, 2005 2:13 PM

Generating files MSDOS Batch
 
I would like to create a batch script that I will put on a scheduled task "XP" (Mon-Fri) to create a simple text file:

the text file's name is today's date
the content of the File is a dynamic url derived from the today's date


example

the filname is mmddyy.strm
the content is mms://hostname/mmddyy/

thanks for the help

Riddle Jun 5th, 2005 12:34 AM

Well.. look into the %date% variable. This doesn't give a mmddyy format, but you might be able to modify it. You could use the echo command and output operators (> for truncating or >> for appending) for the file. Example:
:

echo mms://hostname/%date%/ >> %date%.strm

Of course, this would pose the problem of illegal characters in a filename ('/'), so you'd have to find a way to modify the data given from the %date% variable.

Good luck.

mackenga Jul 21st, 2005 8:31 AM

Oh, I've just noticed the DATE command will give you the DD/MM/YYYY (maybe MM/DD/YYYY on machines in the US; this one's set up for the UK) format date. It prompts for a new date, but you can do:

:

C:\> echo. | date

to avoid that.


All times are GMT -5. The time now is 6:13 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC