Skip to content
jammycakes edited this page Apr 7, 2012 · 8 revisions

PsShortcuts gives you a couple of PowerShell commands to navigate quickly to predefined parts of your filesystem.

Navigating the filesystem is my big bugbear with the Windows command line and PowerShell -- all too often you encounter a folder structure several levels deep, with multiple folders starting with the same gratuitously long part of the name. This is especially the case in Visual Studio solutions, for instance, where projects all have names such as MyCompany.MyDepartment.MyProject.(whatever) and so you have to either type the whole thing out in full or else press Tab an idiotic number of times.

So which would you rather type? This:

cd c:\projects\MyCoolProject\src\MyCompany.MyDepartment.MyProject.Web

Or this:

go myprojweb

For me it's a no-brainer.

This project is a work in progress. I'm hoping to add some extra bits and pieces as time goes by to simplify installation and management of your aliases.

Installation

Step 1. Clone the project to your local machine.

git clone git@github.com:jammycakes/CmdTools.git

Step 2. Make sure that you have enabled PowerShell scripts on your computer. Open PowerShell as an administrator and run the following:

Set-ExecutionPolicy RemoteSigned

Step 3. Now run PowerShell as a regular user, type the following

". c:\path\to\PsShortcuts\go.ps1" >> $profile

Step 4. Restart PowerShell to load the script into your profile.

Step 5. Now create a .go file for your shortcuts:

vim $(Get-UserGoTargetDescriptor)

Or if you don't have vim installed:

notepad $(Get-UserGoTargetDescriptor)

Step 6. Your .go file consists simply of a list of aliases and paths, separated by an equals sign, for example:

windows=c:\windows
winsys=c:\windows\system32
etc=c:\windows\system32\drivers\etc
inetpub=c:\inetpub

Note that you should have no spaces either at the start or end of the line, or before or after the equals sign.

You can use URLs rather than directory paths, these will open in your default web browser:

facebook=https://facebook.com/
twitter=https://twitter.com/

Usage

Typing here will bring up Windows Explorer at the current directory.

Some aliases to commonly used websites are defined out of the box. These are:

Clone this wiki locally