DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Append Date to a Filename

  1. #1
    Join Date
    Jul 2001
    Posts
    334

    Append Date to a Filename

    Hi,
    How can I append the current system Date to file name in batch DOS file.

    E.g file name using in batch file is test.txt, it should be text_052803.txt(in the format of MMDDYY)

    Thanks

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828
    Hi

    @echo off
    for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set DATE=%%C%%A%%B
    set DATE=%DATE:~2%


    regards
    Hrishy

  3. #3
    Join Date
    Jul 2001
    Posts
    334
    Hi Hrishy,
    Thanks for your time and help, I type exactly the same code in my batch file and when I execute from the DOS I get "syntax error" msg.

    Can you please help me.

    Thanks.

  4. #4
    Join Date
    Jul 2001
    Posts
    334
    Please help...Thanks

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    http://www.winscriptingsolutions.com...rticleID=13575

    Took all of three seconds to find on Google.

  6. #6
    Join Date
    Jul 2001
    Posts
    334
    I have tried this link before,(method#2) still same error problem. Is it possible if you could try on your end; see if it works?

    It would be helpfull.

    Thanks

  7. #7
    Join Date
    May 2002
    Posts
    2,645
    Whatever. Try a search on your own or waiting to get the answer here?

    http://searchdatabase.techtarget.com...799184,00.html

  8. #8
    Join Date
    Jul 2001
    Posts
    334
    Thanks for the update, I will try.

    Thanks for your time & help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width