Windows Equivalent of Linux or Unix “Touch” Command

In Linux and Unix there is a “touch” command which will update the timestamp of a file without modifying the contents.  You can also create an empty file without having to open an application among other actions.  In Windows there isn’t a direct equivalent, but you can get close by using the “copy” command with a “+” at the end of the filename while specifying no destination file.  The + symbol points the copy operation back to the source file.  This will update the timestamp while not modifying the contents of the file.

Ex.

copy SampleFile.txt+

WindowsEquivTouch1

WindowsEquivTouch2

This process was helpful for my customer testing out automated CI/CD processes with Azure DevOps and Git.  Hopefully this will be useful to someone else.  Enjoy.

 

-Frog Out

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s