Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: batch file  (Read 3088 times)

0 Members and 1 Guest are viewing this topic.

PaulMarie

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Windows 7
    batch file
    « on: April 03, 2017, 08:34:30 AM »
    I need to create a batch file to test if a date file plus some days is greater than the system date. Is it possible and, if it is, how? (I'm an old man but novice with batch files)
    Thanks

    DaveLembke



      Sage
    • Thanked: 662
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: batch file
    « Reply #1 on: April 03, 2017, 10:05:12 AM »
    Are you saying your looking for files older than that of the date in which the computer was built with OS install date?

    In my picture attached below this HP Windows 7 based computer was purchased and built in 2015 and it has system files that are dated 2009. So you will need an exclusion list in order to keep out system files that I am guessing you dont want to target?

    Do you have a specific folder or directory you want to target to complete this action or just run across the entire C: drive etc?

    Also... there is a cool program I use called XXCOPY that has an "older than" option which xcopy doesnt have with:
    Quote
    /DB:<date>  Copies files that were changed on or before the specified date.

    So if your trying to hunt down some old files that were 1-1-1980 you should be able to find them with the /DB:<date> switch option of xxcopy in which they would be copied to a target location that you specify. The <date> replaced with a date that can be any date you want as a starting point. SYSTEM DATE though is tricky because SYSTEM DATE will be the date in which this is run in which everything would be older than when this is run. So if system was built say in 2015 you can use a date for mm/dd/yyyy for sometime in 2015 or  if you have an idea of how old the files are such as they are of the year 1980, you can specify a date in 1981 and not get anything newer than that date in 1981 etc.

    More here on XXCOPY: http://www.xxcopy.com/xxcopy01.htm




    [attachment deleted by admin to conserve space]

    PaulMarie

      Topic Starter


      Newbie

      • Experience: Beginner
      • OS: Windows 7
      Re: batch file
      « Reply #2 on: April 03, 2017, 11:22:24 AM »
      Thank you very much Dave,
      my question was asked so not too clear and my English is not better... excuse me.
      My purpose is to run a batch file (after converting to exe), to do something - for example to show an icon, until the date of the batch file added to a numer of days is less than the system date, if greater does nothing. The batch file should use a command or a function which compares the two dates.
      Thanks again

      DaveLembke



        Sage
      • Thanked: 662
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 10
      Re: batch file
      « Reply #3 on: April 03, 2017, 12:48:04 PM »
      So your going to use a .bat to .exe conversion so in the end you run the batch file as an exe.

      And you want it to execute for a certain number of days and then no longer run?

      What does the batch file as an exe do beyond that of only running for a short period of time? Where will it be run from? Will it be part of the Windows startup for example to automatically run and do something as long as whatever is to be done falls within the time period specified?

      English saying is... sort of "grabbing at straws" trying to figure out the whole picture to best assist whatever it is that your doing. Also are you not being specific to what it exactly does because you dont want to share what it actually does? its ok if you dont want to specify exactly what the point of this is, but just asking for clarity on this... One suggestion I have is that if english is difficult for you, you can type in your native language whatever it is your trying to do with Google Translator and you can copy paste the english output here which might make for something that is better to understand and more detailed vs struggling with english here.  :)