Touch.exe: Set the timestamp of files to the current time on Windows systems

Touch.exe is a little tool for setting the timestamp of files to the current time. It works on Windows systems and it is a simple version of the touch program commonly found on Unix machines.



Please Visit My Blog

In my blog on blogs.sepago.de I write about various aspects of Windows and Terminal Services.

Table of contents



Revision history

  • 0.1, 07/19/2002
    • First version of touch.exe published.


News and changes

  • 07/19/2002
    • Version 0.1 is available.


Known Bugs

  • None.


Features

Touch.exe sets the modification timestamp of files to the current time. It works with local or network paths, and drive letters or UNC paths.

Touch.exe is a Win32 console program. It's actions are controlled by command line parameters. It always returns a return code, which can be one of the following:
  • 0 for successful execution
  • 1 if usage instructions were printed (when invoked without or too many arguments)
  • 2 if an error condition occured


Usage is as follows:
Usage: touch.exe <path to file>

Sets the modification date/time of <file> to the current date/time.
This is a simple version of the Unix touch program for Win32.
Written by Helge Klein, 2002, http://www.helge.mynetcologne.de


Examples:
Touch.exe "C:\My Dir\My File"

Touch.exe "\\MyServer\MyShare\My Dir\My File"


Remarks

A tool like Touch.exe is needed when modifying roaming profiles of domain users on a file server while the users are logged off. As an administrator you maybe want to copy certain icons the the users' desktops or remove unwanted (temporary) files from the users' profiles. When the user logs on the next time, Windows compares the timestamps of the file NTUSER.DAT in the local copy of the profile with the profile on the file server in order the decide whether to download the profile or use the locally cached version. Only if the timestamp of the file NTUSER.DAT on the file server is newer, then the profile is downloaded.

In other words, if you modify roaming user profiles on a file server, you have to "touch" each user's NTUSER.DAT.

Download

You can download the program here.

License

Touch.exe is free for everyone.

Contact

If you have found a bug or want to submit comments, suggestions or feature requests please feel free to contact me. My name is Helge Klein and I live in Cologne/Germany.