Aliases (Windows)
mkalias.c
 
 
 
Alias is a term borrowed from Unix.
 
A Unix alias is a symbol maintained by the command shell that acts as a shortcut. Each alias has a string value which is substituted for the for it when the alias is typed.
 
In other words, if Windows supported alias, one could set up an alias msword whose string value is "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE". Now if one typed msword on the command line, Microsoft Word would be started.
 
When working from a command prompt I would find this tremendously useful. I wouldn't have to pop back to the start menu or an explorer window to start up another program.
 
But windows does not have aliases per se. It does have some mechanisms that sort of do the same thing but they all present problems for me as decribed here.
 
So I wrote a program, mkalias.c which generates something that works more like a Unix alias. What it actually does is generate a program which contains a fixed string. When the alias program name is typed any arguments on the command line are placed at the end of the fixed string and the resulting command is run as if it were typed in the first place.
 
This might be clearer with an example:
 
 
I have an alias on my system: msword is an alias for "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" If I type msword, Microsoft word starts up. If I typed msword resume.doc, Word starts up to edited the resume.
 
The mkalias program is evolving. Right now it is a little tricky (or clever, depending on your persuasion).
 
Currently mkalias generates a C program containing the fixed string mentioned above and (optionally) compiles that program to generate the actual alias program.
 
This means that you have to have a C compiler on your system (currently Microsoft C and gcc are supported if mkalias.exe compiles the generated program itself.
 
I expect that this is a little confusing. The basic reason I wrote it was that I wanted a way to invoke a Windows program from the command line and each of the standard ways I knew how to do it had problems as described here.
 
As with most of the stuff on this web site, it is assumed that mkalias.exe is somewhere on your command PATH and that the generated alias program will be also, probably in the same place.
 
Future enhancements
 
Notes
 
Porting to Unix
 
Aliases on my system
 
Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 6 of 485)
 
Comments, flames, broken links?
Please send email to maintainer@intricate-simplicity.com