Skip to content

Instantly share code, notes, and snippets.

@SMUsamaShah
Last active March 1, 2024 18:59
Show Gist options
  • Save SMUsamaShah/2b246b3da0d1e710c07772f000972646 to your computer and use it in GitHub Desktop.
Save SMUsamaShah/2b246b3da0d1e710c07772f000972646 to your computer and use it in GitHub Desktop.
(Windows) Daily Notes Prompt at end of work day
@echo off
REM Use: "script.bat Your note here" to append a note to 'daily_note_YYYY_MM_DD.txt'.
REM If no argument given, type note interactively. Press Enter on an empty line to finalize.
REM Note is saved in 'd:\notes'.
setlocal enabledelayedexpansion
REM Creating a Newline variable (the two blank lines are required!) src: https://stackoverflow.com/a/269819/342095
set NLM=^
set NL=^%NLM%%NLM%
REM Extract date components
set "year=%date:~6,4%"
set "month=%date:~3,2%"
set "day=%date:~0,2%"
REM Construct the file name
set "filename=d:\notes\daily_note_%year%_%month%_%day%.txt"
REM If there are command line arguments use the first as the note content
if not "%*"=="" (
echo %* >> %filename%
exit /b 0
)
REM Prompt for note and save it
echo What did you do today:
set "note="
:loop
set "input="
set /p input="> "
if not defined input goto out
set "note=!note!!NL!!input!"
goto loop
:out
echo !note! >> %filename%
endlocal
SCHTASKS /CREATE /SC DAILY /TN "MyTasks\Daily Notes" /TR "d:\notes\dailynotes.bat" /ST 17:30
@SMUsamaShah
Copy link
Author

In cmder create alias note=d:\notes\dailynotes.bat $* directly in user_aliases.cmd

Edit cmder/config/clink_settings file

history.dont_add_to_history_cmds = exit history note

exit history are default values of this property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment