Windows Command Line Hacking (XP/7/8/10)

If you are like me you will drive yourself nuts by typing 'ls' instead of 'dir' in your Windows CLI. After doing this countless times (literally) I decided that there had to be a better way... I will admin that this entire approach is somewhat convoluted but in the end I got what I wanted and so will you!

Here's the basic premise before I jump right into it. We will be leveraging the 'DOSKEY' utility which adds macro capability, command history, and more to your Windows command line interpreter. First we create the shell script to invoke DOSKEY, then create a shortcut which will run the DOSKEY script when the CLI opens

DOSKEY Script - save this to C:\doskey.cmd (or any where that you will remember the path)

@echo off
DOSKEY clear=cls
DOSKEY ls=dir

Create a new shortcut on your Desktop or in Start Menu with the following parameters:

C:\Windows\System32\cmd.exe /K C:\doskey.cmd

The shortcut above will execute the Windows CLI running the DOSKEY commands we put in the shell script before launching the terminal. You will now be able execute whatever commands you put into the script with the macros you defined.

You are now equipped with the power to create whatever macros you want so go nuts!