Implementing linux/unix’s “touch” command on windows.

Purpose of the touch command: create a new file or ‘touch’ some file to update its timestamp; naturally, touching a file that isn’t there will create a new file with a current time and date timestamp.

The binary file is included at the end of this post. However, if you want to “compile” this on your own, you’ll need:

  1. Ruby 1.9.3 (
  2. Ruby 1.9.3 devkit ( — follow the directions at to add the devkit, just in case.
  3. The ocra rubygem (in command prompt [cmd.exe] — type “gem install ocra” without the quotes

Then, with the source code saved as something like touch.rb, do:

You’ll then have touch.exe, which you can place in your C:/windows/system32 folder or /path_to_ruby/bin/ folder, and can use it as so:

Touch.zipSource code and binary.