How to create CMD Aliases

How to create CMD Aliases
Photo by Clay Banks / Unsplash

Hello, today we'll create cmd aliases!

Creating init.cmd file

Open a terminal, run this command. You can use any editor instead notepad:

notepad %USERPROFILE%/init.cmd

Configure init.cmd

You can put these:

@echo off

DOSKEY ls=dir $*

This is an example, you can put another DOSKEYs for it.

Configuring Regedit

reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun ^
  /t REG_EXPAND_SZ /d "%"USERPROFILE"%\init.cmd" /f

This command adds a registry in HKCU\Software\Microsoft\Command Processor\Autorun. Value is: %USERPROFILE%\init.cmd

Restart your cmd

You should restart your cmd. If you don't want to do it, run this command for reload cmd: %USERPROFILE%/init.cmd

Use your aliases

That's all! Please subscribe to my blog for new posts!