Last active
March 1, 2024 18:59
-
-
Save SMUsamaShah/2b246b3da0d1e710c07772f000972646 to your computer and use it in GitHub Desktop.
(Windows) Daily Notes Prompt at end of work day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCHTASKS /CREATE /SC DAILY /TN "MyTasks\Daily Notes" /TR "d:\notes\dailynotes.bat" /ST 17:30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In cmder create alias
note=d:\notes\dailynotes.bat $*
directly inuser_aliases.cmd
Edit
cmder/config/clink_settings
filehistory.dont_add_to_history_cmds = exit history note
exit history
are default values of this property