Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
Last active December 18, 2020 04:17
Show Gist options
  • Save sandipchitale/e9e6057951c95bc60e08eb76bd1817c7 to your computer and use it in GitHub Desktop.
Save sandipchitale/e9e6057951c95bc60e08eb76bd1817c7 to your computer and use it in GitHub Desktop.
Save and show and put history in clipboard with REM prefix
-="C:\Program Files\Microsoft VS Code\Code.exe" "%USERPROFILE%\cmd.history"
_=doskey /history | wsl grep -e '^^[-_+.]' -v | wsl grep -e '^^break' -v | wsl grep -e '^^)' -v | findstr "^" >> "%USERPROFILE%\cmd.history"
+=type "%USERPROFILE%\cmd.history"
.=type "%USERPROFILE%\cmd.history" | wsl awk 'BEGIN { print "break||(" ;} { print $1 } END { print ")" }' | clip
_u=(type "%USERPROFILE%\cmd.history" | wsl awk '!a[$0]++' | findstr "^" > "%USERPROFILE%\cmd.history.bkp") && (type "%USERPROFILE%\cmd.history.bkp" > "%USERPROFILE%\cmd.history") && (del "%USERPROFILE%\cmd.history.bkp")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment