Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know I can change the command prompt to startup on C:\ rather than F:\Documents And Settings or wherever. But I was wondering if it's possible to set bookmarks or some other command that allows me to switch to locations.

For example, my Python projects have a long (about 7 subdirectories) address (think that's the word), and as such it takes a while to cd to them. What I would like to do is something like gotodirectory PythonProjects , and have it cd to where I have specified this, be it C:\WINDOWS or F:\Games\Steam\steamapps\common\some game\some game data\some more game data.

share|improve this question
add comment

5 Answers 5

up vote 3 down vote accepted

Put the below in a batch file called "gotodirectory", place that file somewhere in you path.

Then use as follows -

gotodirectory sys

The below batch also support changing to a different partitions.

Of course you can also add other commands.


@echo off
if "%1"=="sys" (
    cd /d C:\WINDOWS\System32
    goto :EOF
)
if "%1"=="home" (
    cd /d C:\Cygwin\home
    goto :EOF
)
if "%1"=="work" (
    cd /d C:\wwwroot
    goto :EOF
)
share|improve this answer
    
This is a rather neat solution. Thanks! :D –  The Communist Duck Jan 4 '11 at 19:12
1  
Since The Duck mentioned he is using Windows XP, using cmd.exe features would make the script much shorter. For one, you can force cd to change drive letters with /d option. (Using pushd would work nicely too.) Second, goto :EOF makes the explicit :end label unnecessary; there also is exit /b. Third, command grouping - either using ( ) or & - allows you to remove the rest of labels. (Feel free to revert the edit.) –  grawity Jan 4 '11 at 21:46
add comment

Create a batch file and keep it in a directory contained within the default path.

As an example - to get to F:\Games\Steam\steamapps\common\some game\some game data\some more game data

f:
cd "F:\Games\Steam\steamapps\common\some game\some game data\some more game data"

Save that as gotosteam.bat or any name you prefer and you're all set.

share|improve this answer
add comment

You can change the properties of C:\WINDOWS\system32\cmd.exe or create a shortcut to it and specify what directory you want it to start in (and even assign it a shortcut key).

share|improve this answer
add comment

set an environment variable:

% set GD_PYTHONPROJECTS=C:\There\And\There

then use it like

% cd %GD_PYTHONPROJECTS%

how to set environmet variables permanently check out

Set Permanent Environmental Variable in Windows XP

(you can set environment variables permanently via the gui as well, they are stored in there registry anyway)

share|improve this answer
add comment

Yet another answer:

http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

"Cmd prompt here" context menu for windows explorer.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.