DOS窓でtouchコマンド

DOSにはtouchコマンドがないので、下記のようなバッチファイル touch.bat を作成して代用する。これを環境変数Pathで設定した適当なフォルダに置いておけば、touchコマンドと同じように使える。

@echo off
if %1. ==. goto end
if not exist %1 (
    type nul > %1
) else (
    copy /b %1+,, %1 > nul
)
:end