# MS DOS file renaming



## Jeff Klein (May 28, 2001)

I Would like to create a .Bat file that renames a specific file with the date and time within the name. 
eg. Myfile08-09-01:04:00:00

I have an old application that creates a .txt file but each time I run the application the .txt file is replaced with the new one.
I am trying to retain all the old .txt files.

help please

ps: I threw out my old dos books


----------



## MacFromOK (Mar 19, 2001)

I don't think it can be done in DOS using the
current date/time. Both the "date" and "time"
commands require user input (even if it's only
pressing the ENTER key), and you can't get the
current value of either. To rename a file in
DOS, you normally use:

move oldname newname

This would be the same in a batch file (to use
long filenames, enclose the name in quotes).

BTW, these aren't compatible with Windows file names:
\ / : * ? " < > |

----------------------------------------------------

This a little off topic, but...

Renaming a file using the current date/time
would be easy using VisualDialogScript (VDS),
it's a very simple Windows programming language.

Here's how it could be done in VDS:

FILE RENAME, oldname, @datetime(mm-dd-yy-hh-nn-ss)

If you're interested in VDS, check this site:
http://www.dialogscript.com/uk/qtour.html


----------



## The DOS Machine (Jul 15, 2000)

This probably won't help you at all, but you can change the look of the DOS prompt to include the date and time!

You should type: *prompt /?* to see the available commands that you can use. One to try would be: *prompt $p$d$b$t$g* That will give you a prompt with the date, time, and the usual drive/directory information.

Good Luck!









*-DOSMAN*


----------

