The power users of Linux would have cherished the cmd alias option in Linux terminal, Life was made easy by creating small command aliases for commands that were too big to type. Aliases were a life saver which saved us from typos, remembering and typing long commands.
But if you turn to windows you would wonder HOW THE HECK CAN I SET AN ALIAS FOR A COMMAND. Windows has a hidden way of setting DOS equivalent of alias. The Life saver is DOSKEY which is Windows equivalent to alias command in Linux.
For example
As we know "ls" is one of the frequently used command in linux terminal, and many a time we type "ls" instead of "dir" in CMD prompt. We can set "ls" as an alisa for "dir" in CMD prompt as follows
so when we issue ls in CMD prompt it performs the same action as DIR.
But as you will observer this is not a persistent way of setting the alias, its only per CMD prompt session.
You can set an persistent alias by creating a bashrc equivalent for CMD prompt by creating a somename.cmd file and make it auto load whenever you launch a CMD window.
The example somename.cmd file can be
########################################
@echo off
DOSKEY ls=dir
DOSKEY restart=shutdown -r -t 00
########################################
Now the next task is to make this "somename.cmd" to be auto loaded when the cmd window is loaded
This can be done in two ways:
Per CMD window :
But if you turn to windows you would wonder HOW THE HECK CAN I SET AN ALIAS FOR A COMMAND. Windows has a hidden way of setting DOS equivalent of alias. The Life saver is DOSKEY which is Windows equivalent to alias command in Linux.
For example
As we know "ls" is one of the frequently used command in linux terminal, and many a time we type "ls" instead of "dir" in CMD prompt. We can set "ls" as an alisa for "dir" in CMD prompt as follows
DOSKEY ls=dir
so when we issue ls in CMD prompt it performs the same action as DIR.
But as you will observer this is not a persistent way of setting the alias, its only per CMD prompt session.
You can set an persistent alias by creating a bashrc equivalent for CMD prompt by creating a somename.cmd file and make it auto load whenever you launch a CMD window.
The example somename.cmd file can be
########################################
@echo off
DOSKEY ls=dir
DOSKEY restart=shutdown -r -t 00
########################################
Now the next task is to make this "somename.cmd" to be auto loaded when the cmd window is loaded
This can be done in two ways:
Per CMD window :
A particular aliases can be sent to a particular CMD window by creating a shortcut of the cmd.exe and setting the target to the cmd file which you want to be loaded. The path to the somename.cmd in my case "DosKey.cmd" should be appended to the target in the shortcut properties.
option "/k" should be also appended before the path.
option "/k" should be also appended before the path.
Across all CMD windows:
If the aliases should be loaded across all the cmd windows then a registry key needs to be mapped to the path of the "somename.cmd" file
"AutoRun" "String" type registry key needs to be created under
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsofy\Command Processor\
For the current user
and value must be set to the path to the alias file.
\HKEY_LOCAL_MACHINE\SOFTWARE\Microsofy\Command Processor\
For the current user
and value must be set to the path to the alias file.
ReplyDeleteWhat i don't realize is in truth how you are not really a lot more neatly-preferred than you might be now. You are very intelligent. You already know thus considerably relating to this topic, made me personally believe it from so many numerous angles. Its like men and women aren't fascinated except it is one thing to do with Lady gaga! Your personal stuffs great. At all times maintain it up! regions bank online login
Find out much more about monthly mortgage repayments, whether you should rent or buy, and what it is possible to afford with Mortgage Architect's Canadian mortgage calculator. canada mortgage calculator Ask just how much you can pay prior to deciding to trigger the penalty fee. canadian mortgage calculator
ReplyDelete