1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

date format in script

Discussion in 'Windows XP' started by thbaig, Nov 17, 2007.

Thread Status:
Not open for further replies.
  1. thbaig

    thbaig Thread Starter

    Joined:
    Nov 17, 2007
    Messages:
    6
    hello,
    I want to format date in my batch script so that I may use it as file name.How can I format date from default formatting to dd/mm/yy ?
     
  2. moper

    moper

    Joined:
    Feb 14, 2004
    Messages:
    1,657
  3. mpnut

    mpnut

    Joined:
    Nov 21, 2007
    Messages:
    1
    It's been a couple days so you may have already found your solution, but here's another way to name a file with the date you want. You aren't going to want "/" in the filename so you should probably use something like underscores "_". Here's how to rename a file with the date mm_dd_yy:

    REN filename.txt %DATE:~4,2%_%DATE:~7,2%_%DATE:~12,2%.txt

    Hope this helps.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/652807

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice