How do I “touch” a file with standard Windows commands? (Linux – Windows)

Send Us a Sign! (Contact Us!)
Word PDF XPS Text

Scenario

I need to reproduce good old touch hello.c using nothig else but standard Windows commands. How can I change the date of a file, but not its content, using nothing else but what is provided in a standard Windows XP Pro installation (CMD, FIND, SORT, etc.)?

[tweet]

Solution

Open CMD (Run As Administrator). This command will change a file's date and [gs timestamp] to current.

copy <<filename.extn>> /B+ ,,/Y

If you want to do a bulk change in a directory, for say, all .gif files, then:

for %i in ('dir *.gif') do copy %i /B+ ,,/Y

SOURCE

LINK

LANGUAGE
ENGLISH

1 thought on “How do I “touch” a file with standard Windows commands? (Linux – Windows)”

Comments are closed.