wiki:dokuwiki:dos:コマンドプロンプトのtouch

Electron(エレクトロン)で遊ぼうと思ったら、touchコマンドが無かったよ

掲題の通りですが、windows標準のコマンドプロンプトではtouchコマンドが無いらしい。
なんだけど、そこら中にあるElectronのセットアップ手順には、touchコマンドを使用する前提だ。

というわけで、対処法。

  1. Delphiをインストールする
  2. 自作する

実はDelphiをインストールする(無料版)と、touchコマンドがインストールされるらしい。実は私のPCにはDelphiが入っていて、touchコマンドを実行するとEmbacaderoのロゴが出てくるのだ。(そこで、なんかおかしいな~と思っていたわけで・・・)

参考文献:https://docwiki.embarcadero.com/RADStudio/Athens/ja/TOUCH.EXE_%E3%81%AE%E4%BD%BF%E3%81%84%E6%96%B9

touch -h
Touch Version 5.0 Copyright (c) 1995-2010 Embarcadero Technologies, Inc.
 
Usage: TOUCH [options] [filename(s)...]
This utility sets the date and time of the listed files to be the current
(or specified) date and time.  (wild cards * and ? ok)
 
  -a, -f, -m are quietly ignored for Unix compatibility.
  -c    does not create the file if nonexistent (default is to create it)
  -D    allow directory names to be touched (when wildcards specified)
  -h    detailed help
  -n    lists files, doesn't change the date/time (for testing rsp files)
  -rfilename sets the specified files to the same date/time as 'filename'
  -s    recurse through subdirectories
 
  -t and -d can be used with any of the following date and time formats:
     nnddhhmm[yy] Unix syntax sets date&time (nn=month, year is optional)
     hh:mm[:ss]   Borland syntax sets time only (seconds are optional)
     mm/dd/yy     Borland syntax sets date only (mm-dd-yy also works)
     ranges: month:01-12, day:01-31, hour:00-23, min:00-59, sec:00-59,
             year:the last 2 digits of the year representing 1980-2079
 
  -v    verbose mode, prints out the files processed
  -w    warn about unlocatable files and bad time values (default is to warn)
 
@xxxx specifies response file xxxx where any combinations of options or files
can be listed (up to 10 levels of response file nesting allowed).
Long file names must be quoted if spaces are embedded in them (in both response
files and on the command line)

自作する

さて、自作するパターンですが、せっかく参考文献にあるように仕様が書かれているので、C#で遊んでみようと思って作ってみた。
こっちのページです。

  • wiki/dokuwiki/dos/コマンドプロンプトのtouch.txt
  • 最終更新: 2024/05/19 23:32
  • by hoorayeri