Zettelkasten / Markdown
As I move more and more to a purely Markdown-based workflow for keeping notes (Zettelkasten ruins my mind), I was looking for a simpler way to create fresh empty markdown files in a folder. Up till now, I right-clicked in Windows Explorer, selected 'New Text file', glanced at the system clock, converted the current time to something like YYYYMMDDhhmmss, and named the text-file accordingly, like 20210108180300.md.
It struck me that this is precisely what I certainly should automate, so I did the following: I created a small Windows batch file named new-markdown.cmd, which I stored in my personal bin directory (C:\Users\chgeuer\bin\new-markdown.cmd):
Contents of new-markdown.cmd
new-markdown.cmd@ECHO OFF
:: https://stackoverflow.com/questions/12635541/safe-way-to-get-current-day-month-and-year-in-batch
:: Check WMIC is available
WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_error
:: Use WMIC to retrieve date and time
FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
IF "%%~L"=="" goto s_done
Set _yyyy=%%L
Set _mm=00%%J
Set _dd=00%%G
Set _hour=00%%H
SET _minute=00%%I
SET _second=00%%K
)
:s_done
:: Pad digits with leading zeros
Set _mm=%_mm:~-2%
Set _dd=%_dd:~-2%
Set _hour=%_hour:~-2%
Set _minute=%_minute:~-2%
Set _second=%_second:~-2%
:: Display the date/time in ISO 8601 format:
SET _isodate=%_yyyy%%_mm%%_dd%%_hour%%_minute%%_second%
cd /D %1
set HEAD=# %_yyyy%-%_mm%-%_dd% %_hour%:%_minute%:%_second%
echo %HEAD% > "%_isodate%.md"
explorer.exe "%_isodate%.md"Grab some ICO and hook the batch to the registry
Then, I downloaded some ICO file representing markdown, and stored it alongside the batch file, in the bin folder. As a last step, I created these registry entries:
As a result, you get this entry, when you right-click on the empty space in a folder

The last thing in the batch file (this explorer.exe "%_isodate%.md" thing) kicks off your favorite Markdown editor on the newly created MD file.
Links
Alternatively, you can run this utility (with admin rights): install_markdown_YYYYmmdd.cmd.
Last updated