Create datestamped filename via Windows Run dialog

I use this a few dozen times per week. Super useful.

REM /**
REM  * Create datestamped filename via run dialog
REM  * Location: %WINDIR%/f.bat
REM  *
REM  * Usage:  [Win+R] > 'call notes from emily about project scope'
REM  * Output: 2017-11-14_call-notes-from-emily-about-project-scope
REM  * Caveats: No real string sanitization, so special chars like "&" will break it.
REM  */

@echo off
@setlocal enabledelayedexpansion

REM *** Convert everything to lowercase
REM @source

set _STRING=%*
set "_LCASE=abcdefghijklmnopqrstuvwxyz"
for /l %%a in (0,1,25) do (
   call set "_FROM=%%_UCASE:~%%a,1%%
   call set "_TO=%%_LCASE:~%%a,1%%
   call set "_STRING=%%_STRING:!_FROM!=!_TO!%%

REM *** Get system date
REM *** @source
@setlocal enableextensions
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
for /f "tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (
  for /f "tokens=%toks% delims=.-/ " %%i in ('date/t') do (
  set '%%a'=%%i
  set '%%b'=%%j
  set '%%c'=%%k))
if %'yy'% LSS 100 set 'yy'=20%'yy'%
set Today=%'yy'%-%'mm'%-%'dd'% 
ENDLOCAL & SET v_year=%'yy'%& SET v_month=%'mm'%& SET v_day=%'dd'%
set _DATE=%V_Year%-%V_Month%-%V_Day%

REM *** Replace spaces with underscores

REM *** beep at the user!
REM *** @source
rundll32 user32.dll,MessageBeep

REM *** Fire the prompt()
mshta javascript:prompt("Filename generated successfully!","%_DATE%_%_STRING%");close();

Place in your %WINDIR% directory as f.bat and call via Win+R.