Industrial Code and Solutions
for Getting Things Done
There is a problem after you have closed a Windows DOS command window: doskey is also removed, and you have to type it again every time you run cmd.
The solution is to modify the cmd shortcut in the start menu. Now everytime the cmd is loaded doskey is loaded also, with optional macros or even a whole macrofile. This example assumes that your doskey macros are stored in a file named "macrofile.txt" in the macros folder just off the root of the C drive. Modify your path according to your situation.
Modify the cmd shortcut target from
%SystemRoot%\system32\cmd.exe /k doskey /macrofile=c:\macros\macrofile.txt
( The /k switch keeps the command window open after doskey is executed. )
Change the value of the registry key:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor to
Value name: AutoRun
Value data: doskey /macrofile=c:/macros/macrofile.txt
Changing the registry key gives a benefit, or removes a pitfall, depending on how you look at it; if you add code to the shortcut properties the code completion for the command prompt won't work any more.
- Run the dos command doskey /macros:all > C:\macros\macrofile.txt
That's all there is to it. Whenever you add new doskey macros, just run this command again.
Here is the contents of my macrofile.txt:
Feel free to copy and paste into your own macro file if you like them.
Here's what they do:
- ls=dir $* makes ls the same as dir. The $* passes along any arguments you include.
- bye=exit makes bye the same as exit.
- And so on...