How to start Command Prompt at a designated directory
Problem:
There are several utility programs that I need to run on a regular basis, but none of them are registered in GAC. To run those utilities, I have to open a CMD window, and navigate to the directory where they are located. It starts getting annoying when I have to type cd “C:\Program Files\ProgramName\Version\bin” (which is the path to the directory where those utilities are stored) every time that I need to run these utilities. It would be nice if there is a way to set the start-up directory of CMD so that when I start the CMD it navigates to the desired directory automatically.
Solution 1 (not recommended):
One option to do this is to change windows registry. Actually, I was searching on Google, and found many on-line resources about this. Here is one talking about How to change the default startup directory for Command Prompt?
However, as the article has mentioned, there may be risks associated with this method, and it may cause problems when I need to run windows or other regular utility programs, so it is not my favorite solution. I guess the option may be more suitable in other cases, but not in mine.
Solution 2 (my favorite):
After messing around with the CMD.exe and windows shortcut properties, I finally found a much easier way to do what I needed to do. Windows shortcuts have an option for “Start in” location which sets the start-up directory of CMD when it is executed. So, all I needed to do was to create a shortcut on my desktop to CMD.exe, and set its “Start in” location to “C:\Program Files\ProgramName\Version\bin”. (See the screen shot below)
Now, when I launch the shortcut, it starts a regular CMD window and sets the current directory to the right directory (which is “C:\Program Files\ProgramName\Version\bin” in my case). Easy enough?




