Share this page 

Touch a file (windows batch)Tag(s): Misc Prog HowTo


This one-liner will change the date of a file.
copy myfile.txt /B+ ,,/Y

To touch all files given a wildcard

for %i in (*.pdf) do copy %i /B+ ,,/Y
If used in CMD file then you must double the "%".
touch.cmd
for %%i in (*.pdf) do copy %%i /B+ ,,/Y

For a Java solution, see this HowTo.