1.

Solve : Date in created file.?

Answer»

Hi There,

Can someone help me with a couple of things I need.
1. I have a .bat file the backs up some DATA using a command line utility. It writes to a file but when I run again I receive an error saying the file already exists.
This is what made me think if I can add todays date to the FILENAME I would overcome that error.

2. When the command line utility is running it produces lines of text showing what it is doing, can these lines of text be written to an output file. I want to do this because I want this batch file to run every night and if anything goes wrong I want to be able to read the output file to see what the error was.

Thanks for your help.

Best Regards,

SteveFor your second problem you can redirect the output of the utility to a txt file like so:
Code: [Select]utility.exe >> output.txt
And for writing the date as the name for the file try this code:
Code: [Select]set day=%DATE:~4,2%
set month=%DATE:~7,2%
set year=%DATE:~-4%
utility.exe >> %day%%month%%year%.txtThis works if your Time format is set to DD/MM/YYYY

But if it's another format then just say so.

Hope this Helps
,Nick(macdad-)you could say /y I think that should just over write the file but it's probably better if you have them dated.IMHO the date used to name a file should be in the format YYYYMMDD so that files listed by the Dir command will be in date sequence.

Quote from: Dusty on March 26, 2009, 03:26:04 PM

IMHO the date used to name a file should be in the format YYYYMMDD so that files listed by the Dir command will be in date sequence.



But they will anyway if you type dir /od, won't they?Hi Guys,

Perfect. Thanks for all your help.

Got it working just how I wanted. Your input was most appreciated.

Best Regards,


Steve.Glad it worked out for you.
Same Hello guys,

I have a very similar question so I thought it won't be necessary to open a new thread, just a follow-up would be enough.

Basically, what I want to do is to open five tabs in Internet Explorer. I have to work with data PAGES on our company's intranet. I won't get into details about what they are because that would be very long, tedious and boring.

The format of the url is: http://XXXX/XXXX/XXXX/cms[date].html

For example, today would be: http://XXXX/XXXX/XXXX/cms30032009.html (so it is DDMMYYYY)

and I need to have the last five days opened in tabs.

- cms[today -4 days].html
- cms[today -3 days].html
- cms[today -2 days].html
- cms[today -1 day].html
- cms[today].html

I got my answer for today, but how should I write it for the first four tabs?

Thank you

Martydont hijack some one elses thread.It is not a hijack. I admit I don't know the habits of this forum but I know that usually, mods frown on starting a new thread about something that already exists (or is very similar to). You don't know the mods here so you can't assume something with out knowing it.No, I don't know the mods here. I was referring to the mods I know on other forums. Geez, I CERTAINLY did not expect that my first post would fire such reactions. Did I touch a sensible issue? If yes, then I APOLOGIZE. Rest assured though, I am not a troll or anything like that. I just asked a simple question..

Edit:
no it just keeps thing simple this way.


Discussion

No Comment Found