Im searching a tool which allows me to specify some folders as ‘bookmarks’ and than access them on the commandline (on Windows XP) via a keyword. Something like:
C:\> go home D:\profiles\user\home\> go svn-project1 D:\projects\project1\svn\branch\src\>
I’m currently using a bunch of batch files, but editing them by hand is a daunting task. On Linux there is cdargs or shell bookmarks but I haven’t found something on windows.
Thanks for the Powershell suggestion, but I’m not allowed to install it on my box at work, so it should be a ‘classic’ cmd.exe solution.
What you are looking for is called DOSKEY
You can use the doskey command to create macros in the command interpreter. For example:
creates a new command ‘mcd’ that creates a new directory and then changes to that directory (I prefer ‘pushd’ to ‘cd’ in this case because it lets me use ‘popd’ later to go back to where I was before)
The $* will be replaced with the remainder of the command line after the macro, and the $T is used to delimit the two different commands that I want to evaluate. If I typed:
at the command line, it would be equivalent to:
The next step is to create a file that contains a set of macros which you can then import by using the /macrofile switch. I have a file (c:\tools\doskey.macros) which defines the commands that I regularly use. Each macro should be specified on a line with the same syntax as above.
But you don’t want to have to manually import your macros every time you launch a new command interpreter, to make it happen automatically, just open up the registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun and set the value to be doskey /macrofile ‘c:\tools\doskey.macro’. Doing this will make sure that your macros are automatically predefined every time you start a new interpreter.
Extra thoughts: – If you want to do other things in AutoRun (like set environment parameters), you can delimit the commands with the ampersand. Mine looks like: set root=c:\SomeDir&doskey /macrofile ‘c:\tools\doskey.macros’ – If you prefer that your AutoRun settings be set per-user, you can use the HKCU node instead of HKLM. – You can also use doskey to control things like the size of the command history. – I like to end all of my navigation macros with \$* so that I can chain things together – Be careful to add quotes as appropriate in your macros if you want to be able to handle paths with spaces in them.