oldjamey
8/14/2013 - 7:45 AM

popular *nix commands ported to windows cmd.exe environment.

popular *nix commands ported to windows cmd.exe environment.

# touch
## doesn't work on read-only files
type nul >>file & copy file +,,

## for read-only files, use the following:
:touch
if not exist "%~1" type nul >>"%~1"& goto :eof
set _ATTRIBUTES=%~a1
if "%~a1"=="%_ATTRIBUTES:r=%" (copy "%~1"+,,) else attrib -r "%~1" & copy "%~1"+,, & attrib +r "%~1"