touch

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Hello,
I want set the date of a file with:
TOUCH /F /Dc7.5.1960 /Tc5:33:45 /Dw17.5.1961 /Tw15:03:45 "dateiname.txt"
Unfortunately, it does not work. What the reason? It is not possible to set a date BEFORE 1970?

Thanks for Your help.

greeting from germany
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,376
39
Albuquerque, NM
prospero.unm.edu
#2
That depends on the file system. NTFS allows dates from 1601, I think; FAT only allows dates from 1980.

But I'm not at all sure that TOUCH supports changing two stamps at once. To set both the creation and the last-write stamp, you may have to call TOUCH twice.
 
#3
But I'm not at all sure that TOUCH supports changing two stamps at once. To set both the creation and the last-write stamp, you may have to call TOUCH twice.
Neither TOUCH nor any other command supports referencing more than one type of timestamp in a single command. The only exception is date and time ranges, which could be a different time type than what is used elsewhere in the command. This is the way CMD.EXE works, and changing it has major issues with option specifications as well as command and response line lengths. OTOH it would occasionally be nice to have a report of more than one of the timestamps, ordering based on a different stamp than displayed, etc. But this is needed rarely enough that I would not request it.

One can RETRIEVE more than one type of timestamp in a single command by using the @FILEDATE[] and / or @FILETIME[] function more than once in a single command, once for each type of timestamp to be retrieved.