Search This Blog

Command Prompt CMD How to print time and date. 日付や時刻の出力

コマンドプロンプトでの日付と時刻の出力を工夫してみる。

C:\>echo %date% %time%
2016/03/03 10:18:16.88

C:\>echo %date:/=% %time::=%
20160303 101856.37

##Use in Batch File(.bat)##

C:\>echo.|date|find "/"
現在の日付: 2016/03/03

C:\>echo.|time|find "."
現在の時刻: 10:22:34.69

C:\>date< nul| find "/"
現在の日付: 2016/03/03

C:\>time< nul| findstr \.
現在の時刻: 10:24:10.31

C:\>robocopy /?| findstr 2016
  開始: Thu Mar 03 10:25:19 2016

C:\>prompt [$t -started-%time%]

[10:27:37.42 -started-10:27:37.42]
[10:28:01.84 -started-10:27:37.42]