This works for me on Windows 10.
You will need ffmpeg (free software) and HandbrakeCLI (open source (this also means "free")).
PATH\TO\
in :NOAUDIO
and :HANDBRAKE
with the path to those files in your system.Save this as RecordDesktop.bat and run it to record your desktop:
@ECHO off
TITLE RecordDesktop
SET /P Input=Enter filename (.mp4 extension will be added automatically):
SET /P =Press any key to begin the recording. Then, press Q to stop recording.< NUL
PAUSE > NUL
GOTO NOAUDIO
:NOAUDIO
PATH\TO\ffmpeg\bin\ffmpeg.exe -f gdigrab -framerate 30 -i desktop -vcodec libx264 %userprofile%\Videos\%Input%_TEMP.mp4
GOTO HANDBRAKE
:HANDBRAKE
PATH\TO\handbrakecli\HandBrakeCLI.exe -i %userprofile%\Videos\%Input%_TEMP.mp4 -o %userprofile%\Videos\%Input%.mp4
DEL %userprofile%\Videos\%Input%_TEMP.mp4
ECHO Finished!
SET /P =Press any key to exit.< NUL
PAUSE > NUL
explorer /select,%userprofile%\Videos\%Input%.mp4
EXIT