← Back to Tiny Hacks

Aliases in Windows Command

To create short-cuts/alises for commonly used commands using DOSKEY type

doskey short-cut=command-string

in the Windows command prompt. Here are some of the short-cuts/aliases I use:  

doskey ..=cd ..
doskey ...=cd ..\..
doskey home=cd %USERPROFILE%
doskey ws= cd %USERPROFILE%\workspace\

To make sure that these short-cuts/aliases are loaded each time you start cmd in Windows Terminal, create a .cmd file with all your doskey definitions (say init_win_command.bat) and pass it as an argument (\K) to the command line it in your profiles.json settings files. Here's a snippet from my profiles.json file: 

                "guid": "{e8205cf1-cca9-4b70-8ca6-bad1e0d4be0d}",
                "name": "Windows Command",
                "commandline": "%windir%\\system32\\cmd.exe \"/K\" %USERPROFILE%\\init_win_command.bat",
                "startingDirectory" : "%USERPROFILE%\\",
                "hidden": false,
                "colorScheme" : "nord"