CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: MSCmdSHell

Simple batch file that works like touch command in unix

219 Views
Copy Code Show/Hide Line Numbers
@echo off
if (%1)==() goto end
if not exist %1 goto createEmpty
:touch
copy /b %1+ > nul
echo %1 was touched!
goto end
:createEmpty
type %1>%1
echo %1 was created!
:end
by Al Gonzalez
  February 19, 2010 @ 9:14pm
Tags:
Description:
Will update the timestamp on the specified filed.
NOTE: Will creates a zero-length file if specified file is not found.

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate