vote up 3 vote down star

What do you use when you want to update the date-modified field of a file on Windows?

  1. commands accessible via C++, .NET, C#, or something native to Windows (Vista preferably)
  2. tools/applications preferably free, and if possible open source as well

Edit: there is already a page for applications as pointed out by CheapScotsman here.

If anyone knows how I can do this via C++, C#, WSH or something similar, well and good, else I would think everything else is covered in the linked question.

flag

migrated from stackoverflow.com

6 Answers

vote up 4 vote down check

If you feel like coding it yourself, .NET offers the File.SetLastAccessTime, File.SetCreationTime and File.SetLastWriteTime methods.

link|flag
As good as it gets. Thanks. – facepalmd Jul 22 at 19:44
vote up 3 vote down

You could also install Cygwin which gives you Touch as well as a plethora of other *NIX commands.

link|flag
can't live on windows without cygwin. – jweede Sep 10 at 12:32
And cygwin without mintty is pretty lame. – Ahe Jan 25 at 14:30
vote up 3 vote down

Here's a simple regfile I wrote to add right-click "touch" in Windows explorer. It'd be easy to script it, too, since it just calls:

cmd.exe /c copy %1+nul %1 /by
link|flag
1  
Useful and handy too. Thanks. – facepalmd Jul 21 at 22:12
And don't forget copy nul some_file to create an empty file (which is what I see touch most often used for). – Johannes Rössel Aug 27 at 6:28
vote up 2 vote down

How about codeproject "Touch for Windows": http://www.codeproject.com/KB/applications/touch_win.aspx

edit; Same question as here: http://stackoverflow.com/questions/51435/windows-version-of-the-unix-touch-command/51439

link|flag
Thanks. I missed that in my search which resulted in loads of touch screen phone related stuff. Probably needs a better tag label I guess. – facepalmd Jul 21 at 21:52
vote up 1 vote down

There are Windows ports of many Unix utilities. Have a look at unxutils or GnuWin32 projects.

link|flag
vote up 0 vote down

There is an utility which adds touch to the context menu (right-click) of a folder. More information is available here

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.