0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

batファイルで日付を取得

Last updated at Posted at 2020-09-02

#目的
batで日付取得して使いたいとき。
たまにしか使わずすぐ出てこないのでメモ。

setdate.bat
set YYYY=%date:~0,4%
set MM=%date:~5,2%
set DD=%date:~8,2%
set TIMESTAMP=%time: = 0%
set HH=%TIMESTAMP:~0,2%
set MI=%TIMESTAMP:~3,2%
set DATETIME=%YYYY%%MM%%DD%%HH%%MI%

echo %DATETIME%

##過去使用した場面

  • oracleのexpdp/impdpでlog/dmpファイル名称のprefix
  • Windowsのサービス上げ下げするバッチの日時記録
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?