rodrigosantosbr

Create permanent DOSKEY in Windows cmd

Feb 4th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Create a macro definition file, for instance in notepad; name it at will and save it anywhere (for instance, in next example I used filename macros.doskey in d:\bat\ folder).
Alternatively, doskey /macros>d:\bat\macros.doskey command will list all current macro definitions into d:\bat\macros.doskey file.
A sample macro definition file could be as follows (note that ==> is my command prompt specified by prompt $Q$Q$G$S command):

==> type d:\bat\macros.doskey

ls=dir /B $1
ip=ipconfig $*
pwd=echo %cd%
ls=dir $*
mv=move $*
cp=copy $*
cat=type $*
clear=cls

Then, next commands should do the job:

reg add "HKCU\Software\Microsoft\Command Processor" /v Autorun /d "doskey /macrofile=\"d:\bat\macros.doskey\"" /f

The operation completed successfully.

reg query "HKCU\Software\Microsoft\Command Processor" /v Autorun
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
    Autorun    REG_SZ    doskey /macrofile="d:\bat\macros.doskey"
Add Comment
Please, Sign In to add comment