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
NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...
ALL comments are moderated. I will review every comment before it will appear on the blog.
Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...
I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...
Please see my comment policy for more information if you are interested.
Thanks,
Greg
PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...