Batch File to Change Date on PC
Results 1 to 5 of 5

Thread: Batch File to Change Date on PC

  1. #1
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    19

    Batch File to Change Date on PC

    Hi guys

    I want to add a line into my batch file that will read the current date on the pc and then change it back by 5 days exactly.

    Does anyone have any ideas on how to do this ?
    Thanks

  2. #2
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341
    Hi toon; This would be extremely difficult, if not impossible. The first problem is, there's no good way to do math in a batch file. Now, you could do it with by using the batch file to run a small BASIC program, but even then, the BASIC program would take some doing.

    Suppose it was March 2, in a leap year. You'ld have to read today's date, and the month, and the year, and detemine whether the month before was 28, 29, 30, or 31 days. You'ld have to calculate the year to see if it was a leap year or not.

    A bit more than meets the eye.

    I could do it if you want, but its not a very elegant solution.

  3. #3
    Join Date
    Apr 2001
    Location
    Ireland
    Posts
    19
    thanks for the reply Mr Dex

    I'm actually just going to change the date manually... for the sake of 5seconds!

    thanks a million

  4. #4
    Join Date
    Jan 2003
    Location
    Australia
    Posts
    1,743
    Quote Originally Posted by ToonLoon
    I'm actually just going to change the date manually... for the sake of 5seconds!
    I think that's best...

    You could probably do it with this:

    http://www.merlyn.demon.co.uk/programs/nowminus.exe

    With these instructions:

    http://www.merlyn.demon.co.uk/programs/nowminus.txt

    but as Dexahol says, messy...

  5. #5
    Nix's Avatar
    Nix is offline Aka: Nix*, NNiixx, Nix23
    Join Date
    May 2001
    Location
    Sydney, Australia
    Posts
    8,255
    Firstly curious as to why you want you PC 5 days behind the current date.

    Secondly you should only need to do this once unless your PCs date is getting synconised from a network or on the www somewhere.

    ie if You went in and changed it today to 29.03.2005 and then you boot up tomorrow and you PC says 30.03.2005 and you change it back 5 days it will be 25.03.2005 and so on......

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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