Friday, May 17, 2013

Change the default directory of cmd in Windows.

While using cmd for compiling and running programs of  <Insert favourite programming-language here>, it sometimes becomes tiresome to switch to the directory where you saved the source file. Worse yet,if you close the command prompt accidentally , you have to repeat the process again.
     Fortunately,there's a registry-hack to set the default directory whenever you open you cmd.Here are the steps.
  1. Press Windows Key + R(Or Start=>Run).
  2. Type "regedit".
  3. From the menus in the left pane, navigate to

    HKEY_CURRENT_USER \ SOFTWARE \ Microsoft \ Command Processor
  4. If it does not already exist,Right click on any empty area on the right pane, click New => String value.Name it as "Autorun".
  5. Now suppose you want to set the default directory to D:\Java , you can double click the autorun string,and in the value field type

    CD /d D:\Java
                                                        Hope it helps :)

No comments:

Post a Comment