Skip to content

Instantly share code, notes, and snippets.

@phx
Created August 14, 2013 07:45
Show Gist options
  • Select an option

  • Save phx/6228793 to your computer and use it in GitHub Desktop.

Select an option

Save phx/6228793 to your computer and use it in GitHub Desktop.
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment