Shortening the path of a DOS prompt

Since the day I started using ruby, I’ve been spending most of my time on the command prompt. Lately I’ve faced an annoying problem. My .rb files are placed in a deeply nested directory. It now yields a ridiculously long path when accessed from the prompt. To fix this, I could just opt to use this solution i found from artofbi.com, wherein the long path will be mapped to an open drive letter. (see how its done through the example below)

subst R: "C:\Documents and Settings\zorro\My Documents\SYSTEM_Z\Data Migration\Scripts\2013\10\ruby"

The long path can now be accessed just like any of your C:, D:, etc. drives.

This looks clean, but i prefer another solution. I got the solution from Scott Hanselman’s blog. Of course, I got the link to that blog from a post in stackoverflow (credits to where credits are due, especially to Jim of SO for his correct answer). Below is the solution:

  1. Right-click on My Computer
  2. Click Properties.
  3. Click Advanced Tab
  4. Click Environment Variables
  5. Add a new User Variable called PROMPT
  6. Set the variable’s value to:  $p$_$+$g

It was clearly explained in Scott’s blog what those symbols meant, along with a bevy of other tricks on how to manipulate your command prompt, so there is no point to rehash all of it here.

Hope this helps you on your windows and/or ruby journey.