Need help with server administration?
RSS icon Email icon Home icon
  • How to rename a file name to a prefix + current date in DOS batch file

    Posted on June 10th, 2009 servbit2 3 comments

    Hi

    My machine is an NT. Everyday, there will be a file (i.e. abc.txt) output to my NT server & I need to write a program (in DOS batch file) to rename the file from abc.txt to abc210300.txt

    The 210300 means 21st March 2000, if today is 21/3/2000. So, everyday the program will be scheduled to run and reanme the abc.txt to

    “abc” + current date + “.txt”

    This is the batch file commands I have now, but I don’t know how to put in the date portion.

    @echo off
    echo.

    rename c:\temp\abc.txt abc123.txt

    @echo off

    Thank you.
    n_chai

    there is no way to write a batch file(*.BAT, with out using some sort of program.

    I could wirte the program for you, use some programs i have at home.

     

    3 responses to “How to rename a file name to a prefix + current date in DOS batch file” RSS icon


    Leave a reply

    You must be logged in to post a comment.