● Table of Contents :

HUGOの記事を生成するWindowsバッチファイル|日付時刻をベースに

chcp 65001
@echo off
cd C:\Users\ai\Desktop\HUGO新規
set TIME2=%TIME: =0%
set mdfilename=%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%-%TIME2:~0,2%-%TIME2:~3,2%-%TIME2:~6,2%-09-00
set trim=+++
(echo %trim%) >> %mdfilename%.md
set trim=date = ^"%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%T%TIME2:~0,2%:%TIME2:~3,2%:%TIME2:~6,2%+09:00^"
(echo %trim%) >> %mdfilename%.md
set trim=slug = ^"%mdfilename%^"
(echo %trim%) >> %mdfilename%.md
set trim=categories = [""]
(echo %trim%) >> %mdfilename%.md
set trim=topics = [""]
(echo %trim%) >> %mdfilename%.md
set trim=tags = [""]
(echo %trim%) >> %mdfilename%.md
set trim=title = "タイトル"
(echo %trim%) >> %mdfilename%.md
set trim=+++
(echo %trim%) >> %mdfilename%.md
(echo.) >> %mdfilename%.md
(echo.) >> %mdfilename%.md
set trim=## 
(echo %trim%) >> %mdfilename%.md
(echo.) >> %mdfilename%.md