Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005

    Unanswered: Batch Files.......probably not the right area!

    I know this is a DOS question but felt someone might know the answer. I open several of my MS Access Applications using batch files. Works great, but, our network is set up to take any files over 2 years old and move them to Read Only and Hidden. Thus, my shortcuts can't find them. I was looking to have the batch file save itself when finished running so the date was always current, but can't seem to find any examples of code that would perform that function prior to the EXIT command.

    Anyone have any suggestions?"

  2. #2
    Join Date
    Dec 2015
    Guisborough, England
    Check up about a 'touch' utility. There is something in Linux, maybe something in DOS.

    I've seen a suggestion to use:

    copy /b $0 +,,

    in the batch file, where /b forces binary as opposed to text data, the $0 is batch parameter zero which is the name of the command as opposed to any following real parameters, and the +,, tells copy to append, in effect, to append nothing (what's between the commas). This should force DOS to reset the date/time stamps.

    One problem is that the syntax applies to a file in the current directory, which may not be appropriate. Or you could replace the $0 with the literal name of the path/file.

    Somewhat more complicated, you could create a little .EXE that you would run from your .BAT file which would open the .BAT file as a binary file, amend say 1 byte in a comment line, and write the data back - however, this is opening a file that is already open (to process the .BAT file) and some systems may have a problem. To avoid this, one new .BAT file could first run the usual .BAT file, and then a second small .BAT file to implement the 'touch' - the use of a parameter could mean that you'd avoid creating too many extra .BAT files.

    There are other ways of getting 'normal' .BAT commands to do the job, but reading suggests that some of these work in some environments, but not others. The 'copy' variant detailed above should be most general.


Tags for this Thread

Posting Permissions

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