Command Line Shortcut Utility

This weekend I made some time to work on a utility to make it easier to execute common tasks from the command line.

Jumper is a simple utility for Microsoft Windows that allows you to quickly perform command line tasks. Originally, I just wanted a way to switch directories quickly but it didn't take long before I started adding all sorts of additional features.

Simple Example

Let's just say we needed a shortcut to a folder deep inside a directory. We could write a shortcut to navigate quickly to that folder.

j -add:website cd /d c:\projects\code\websites\joesPizza\root\

Now, instead of having to type the full path in every time we can use the Jumper utility to navigate there quickly.

j website
executes: cd /d c:\projects\code\websites\joesPizza\root\

And just like that you're switched!

Using Parameters

Of course, using a unique key for every single command might be a little excessive so Jumper allows you to include arguments that are replaced when the command is executed. Let's change the previous example to allow us to change the client name on the fly.

j -add:website -args:% cd /d c:\projects\code\websites\%0\root\

The args switch allows us to identify the characters to prefix arguments with. These are numeric indexes (starting with zero). This means we can use arguments as part of a jump command.

j website joesPizza
executes: cd /d c:\projects\code\websites\joesPizza\root\

j website localBank
executes: cd /d c:\projects\code\websites\localBank\root\

j website coffeeHouse`
executes: cd /d c:\projects\code\websites\coffeeHouse\root\

I've already noticed a few improvements for replacing arguments so I'll have updates in the future for that section.

Executing From Different Paths

The first two examples showed how you could quickly switch directories. The last example shows how you can run commands without needing to browse to the folder first.

The rebase switch uses the current working directory to determine where to switch to. Make sure you're in the correct directory before adding a command that uses this feature.

cd c:\projects\code\websites\
j -add:publish -args:% -rebase:true ftp_publish.exe -publish -site -folder /%0

The rebase command tells Jumper to switch directories before running the command. Once finished the utility will return to the directory you started in. Now, we can publish using command line FTP tools from anywhere.

j publish joesPizza
executes: ftp_publish.exe -publish -site -folder /joesPizza

Work In Progress

If you're interested in trying out this utility you can download it below. Extract the contents into a separate directory and then add the folder to the PATH environment variable.

It is important to add the directory that contains the utility to the PATH variable if you want to be able to use the j shortcut from anywhere.

Please feel free to report any bugs or share any feedback you have.

May 1, 2011

Command Line Shortcut Utility

Simple utility to create shortcuts for commonly used console commands.