Touching a file (changing last updated Date/time) with the COPY command. Here's how and a little history too.
The Old New Thing - Why is the syntax for touching a file from the command prompt so strange?
The magic incantation for updating the last-modified date on a file is
COPY /B FILE+,,
What strange syntax! What's with the plus sign and the commas, anyway?
The formal syntax is the much more straightforward
COPY /B A+B+C+D
This means to start with the file
A
, then append the filesB
,C
, andD
, treating them all as binary files.If you omit the
B+C+D
part, then you get ...COPY /B A+
This means "Start with A, then append nothing." The side effect is that the last-write time gets updated, because the command processor opens
A
for append, writes nothing, then closes the handle....
As you know, I love these kinds of posts. First off I didn't know you could even do this with the COPY command, secondly I had to laugh that he tried it on MS-DOS versions all the way back to 2.1 and finally the reminder that backward compatibility can be a...
No comments:
Post a Comment