App Paths in Vista/XP

If your like me and start up a lot of applications that do not have shortcuts in your start menu or on your desktop you may find this tip useful.

In both Vista & XP you can configure Application Paths. Lets say as an example that I want to start notepad.exe by just typing in note.exe or even npd.exe I can edit the registry to make it allow this. This also is handy if you have some programs that you use often but are not in your Start Menu or Desktop such as PuTTy.

What you need to do is open up regedit with Administrative privileges. The location you need to navigate to is:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths

If I highlight App Paths in the left pane and right click in the right pane and select New -> Key I can type in what I want to type to run the application. In this case I’ll use npd.exe. Once the key is created all that is needed is to edit the Default value with the location and name of the exe, so c:windowsnotepad.exe. Now whenever I type npd.exe into the search box on Vista or the Run box on XP it will bring up Notepad for me.

Warning: Before changing any aspect of your registry it is a good idea to do a full backup of your registry in case anything goes wrong.

A quick update: An open source app has been created to do this for you


Subnetting can be the bane of the Cisco Student’s life(no subnetting calculators allowed!) so here are some simple methods to make it go a lot smoother for you.

First off a little bit about subnetting. Subnetting is the process whereby you ‘borrow’ bits from the host portion of a network to reduce the number of possible hosts on each network while increasing the number of possible networks based on the original subnetwork. As an example if we have and we needed 6 separate subnetworks with a maximum of 30 hosts per subnetwork we could borrow 3 bits from the host portion of the network address. Looking at it in bits it would appear like this

11000000.10100100.00000001.00000000 = Network)

11000000.10100100.00000001.00000000(In CCNA curriculum this subnet is unused)
11000000.10100100.00000001.11100000(In CCNA curriculum this subnet is unused)

The red portion indicates the borrowed bits and what they would appear to be for each subnetwork. As you can see there are 8 in total but according to CCNA curriculum 2 are unusable, this isn’t the time to debate what CCNA says since this is targeted towards CCNA students.

The CCNA Method that is taught is to look at this completely in a bit wise fashion and to use 2^bitsborrowed – 2 to determine the number of hosts and number of networks. For the example network above the two calculations would be 2^3-2=6 subnetworks and 2^3-2=30 hosts. By using a chart we can turn this into a simple lookup table that is easily recreated anytime you need it

Hosts Subnet Mask/CIDR SubNetworks
256 0/24 1
128 128/25 2
64 192/26 4
32 224/27 8
16 240/28 16
8 248/29 32
4 252/30 64
2 254/31 128
1 255/32 256

As you have probably noticed there are a few subnetworks that are useless, 2 hosts and 1 host subnetworks are useless for anything. They are just included for completeness to show how the number progression continues. In addition to this you must remember to take 2 off the hosts column when you are using it to lookup. You can write it with the 2 already taken off but this way you are just halving the number each time which keeps a simple progression.

The table is created quite easily. The Hosts go down the left hand column and start at 256 and halve each time until they reach 1. The Subnet Mask is determined by simply adding on the previous Subnet Mask to the current number of hosts while the Subnetworks simply doubles each time until it reaches 256.

Now to use our table. If you take our previous example of subnetted into 8 subnets each able to hold 30 hosts and look at our table we see in a row “32 224 4” This gives us all the information we need to actually complete our subnetting in one easy step. We have 30 hosts, a Subnet mask of 224(full subnet mask would be and a total subnetworks of 4.

Now to find what each of those subnetwork addresses would be as well as the broadcast address for each subnetwork all we need to do is look at how many hosts we have. In this case we have 30 hosts per subnetwork. Effectively though there are 32 IP addresses on that range, but two are taken up already. One is the subnetwork address which is all 0’s in the host portion and the other is the Broadcast address which is all 1’s in the host portion. To work out each subnetwork all we need to know is that every 32 is a new subnetwork. So,,,,,,,

Now we know the broadcast address is always the last IP address on a subnetwork so all we need to do is take away 1 from each subnetwork address to find out the previous subnetworks broadcast address. So,,,,,,, This can also be achieved by taking away 1 from the total hosts and adding that onto the subnetwork address.

Once you have used this chart for awhile and drawn it up several times you will probably find that you have memorised it. Congratulations! At that point you can do all the subnetting in your head without external aids.

Some people may notice that this methodology isn’t as useful when you go over 256 hosts by either starting with a Class C address or using Supernetting. The table can be extended fairly easily to include these scenarios. The Total number of Hosts just continues to double each time(256, 512, 1024, 2048 etc) while the subnet mask and the number of subnetworks just repeat again. So to give an example of an extended table that takes into account Class B addresses:

Hosts Subnet Mask/CIDR Networks
65536 0/16 1
32768 128/17 2
16384 192/18 4
8192 224/19 8
4096 240/20 16
2048 248/21 32
1024 252/22 64
512 254/23 128
256 0/24 256
128 128/25 2
64 192/26 4
32 224/27 8
16 240/28 16
8 248/29 32
4 252/30 64
2 254/31 128
1 255/32 256

Moving Users & Program Files in Vista

Having recently upgraded to Vista I decided it was high time to look at separating my user and program files from my Operating System. So I shifted around some files and formatted my D: drive in preparation for moving the files. I played with a few different methods for moving the user files including updating their Profile Path using the Users & Groups section in Computer Management but despite it working I felt this wasn’t what I was looking for so started looking at using Junctions to redirect my files instead. Ultimately through the use of a DOS Prompt and junctions I’ve moved all my user & program files off to my D: Drive. Here are the steps and information involved.

Windows Vista already uses several junction points which need to be replaced with our own ones. I have listed them here along with where they point to:

In the Root C:
Documents & Settings -> Users

In each User directory:
Application Data -> AppDataRoaming
Cookies -> AppDataRoamingMicrosoftWindowsCookies
Local Settings -> AppDataLocal
My Documents -> Documents
NetHood -> AppDataRoamingMicrosoftWindowsNetwork Shortcuts
PrintHood -> AppDataRoamingMicrosoftWindowsPrinter Shortcuts
Recent -> AppDataRoamingMicrosoftWindowsRecent
SendTo -> AppDataRoamingMicrosoftWindowsSendTo
Start Menu -> AppDataRoamingMicrosoftWindowsStart Menu
Templates -> AppDataRoamingMicrosoftWindowsTemplates

All users have the same Junctions in their user directories, including Default. There are two other Junctions created in the Users directory, these are:
All Users -> ProgramData
Default User -> Default

ProgramData is located is a directory in root C:.

As you can see there are numerous links to recreate. The reason why they are used is to provide backward compatibility with software designed explicitly for Windows XP that may have hardcoded the Documents & Settings directory or other directories within each User Profile. As a result you could try without them and any programs explicitly designed for Windows Vista should work perfectly as well as the majority of Windows XP programs but you may still run into issues. As its fairly simple to recreate the links its worthwhile doing.

The program that is used to create a link is called mklink and it is included with Windows Vista so no extra downloads are required for it.

Usage:Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.

Target specifies the path (relative or absolute) that the new link refers to.

The majority of the folders we will be linking we will be using Directory Junction’s. This is roughly equivalent to a Hard Link. The usage is pretty easy to follow and if you have any trouble you’ll get a better idea of it in the nitty gritty of moving the files around.

Okay before rebooting what we’ll do is create a batch file which does everything for us. This is a lot easier than typing it all in at the command prompt and allows us to check easily for any missing parts. So open notepad.exe and we’ll get on with it. Just remember to replace any drive letters and other path issues that need to be different for your system.

The first part of the file is just creating the destination directories and then copying the files:

mkdir D:Users
robocopy /XJ /MIR "C:Users" "D:Users"
mkdir D:ProgramData
robocopy /XJ /MIR "C:ProgramData" "D:ProgramData"

If you want to move your Program Files directory as well then include this bit:
mkdir "D:Program Files"
robocopy /XJ /MIR "C:Program Files" "D:Program Files"

Next we delete the original files off the C: Drive

rmdir /S /Q "C:Users"
rmdir /S /Q "C:Program Files"
rmdir /S /Q "C:ProgramData"
rmdir /S /Q "C:Documents & Settings"

Next we will recreate the user links:
mklink /J "D:UsersUserNameApplication Data" "D:UsersUserNameAppDataRoaming"
mklink /J "D:UsersUserNameCookies" "D:UsersUserNameAppDataRoamingMicrosoftWindowsCookies"
mklink /J "D:UsersUserNameLocal Settings" "D:UsersUserNameAppDataLocal"
mklink /J "D:UsersUserNameMy Documents" "D:UsersUserNameDocuments"
mklink /J "D:UsersUserNameNetHood" "D:UsersUserNameAppDataRoamingMicrosoftWindowsNetwork Shortcuts"
mklink /J "D:UsersUserNamePrintHood" "D:UsersUserNameAppDataRoamingMicrosoftWindowsPrinter Shortcuts"
mklink /J "D:UsersUserNameRecent" "D:UsersUserNameAppDataRoamingMicrosoftWindowsRecent"
mklink /J "D:UsersUserNameSendTo" "D:UsersUserNameAppDataRoamingMicrosoftWindowsSendTo"
mklink /J "D:UsersUserNameStart Menu" "D:UsersUserNameAppDataRoamingMicrosoftWindowsStart Menu"
mklink /J "D:UsersUserNameTemplates" "D:UsersUserNameAppDataRoamingMicrosoftWindowsTemplates"
mklink /J "D:UsersUserNameAppDataLocalApplication Data" "D:UsersUserNameAppDataLocal"
mklink /J "D:UsersUserNameAppDataLocalHistory" "D:UsersUserNameAppDataLocalMicrosoftWindowsHistory"
mklink /J "D:UsersUserNameAppDataLocalTemporary Internet Files" D:UsersUserNameAppDataLocalMicrosoftWindowsTemporary Internet Files"
mklink /J "D:UsersUserNameDocumentsMy Music" "D:UsersUserNameMusic"
mklink /J "D:UsersUserNameDocumentsMy Pictures" "D:UsersUserNamePictures"
mklink /J "D:UsersUserNameDocumentsMy Videos" "D:UsersUserNameVideos"

Replace Username with whatever the username you are working on is, just use Find & Replace in Notepad to fix it up. You need to use that piece of code for all users that you have added to your system. The code for Default is as follows:

mklink /J "D:UsersDefaultApplication Data" "D:UsersDefaultAppDataRoaming"
mklink /J "D:UsersDefaultCookies" "D:UsersDefaultAppDataRoamingMicrosoftWindowsCookies"
mklink /J "D:UsersDefaultLocal Settings" "D:UsersDefaultAppDataLocal"
mklink /J "D:UsersDefaultMy Documents" "D:UsersDefaultDocuments"
mklink /J "D:UsersDefaultNetHood" "D:UsersDefaultAppDataRoamingMicrosoftWindowsNetwork Shortcuts"
mklink /J "D:UsersDefaultPrintHood" "D:UsersDefaultAppDataRoamingMicrosoftWindowsPrinter Shortcuts"
mklink /J "D:UsersDefaultRecent" "D:UsersDefaultAppDataRoamingMicrosoftWindowsRecent"
mklink /J "D:UsersDefaultSendTo" "D:UsersDefaultAppDataRoamingMicrosoftWindowsSendTo"
mklink /J "D:UsersDefaultStart Menu" "D:UsersDefaultAppDataRoamingMicrosoftWindowsStart Menu"
mklink /J "D:UsersDefaultTemplates" "D:UsersDefaultAppDataRoamingMicrosoftWindowsTemplates"
mklink /J "D:UsersDefaultAppDataLocalApplication Data" "D:UsersDefaultAppDataLocal"
mklink /J "D:UsersDefaultAppDataLocalHistory" "D:UsersDefaultAppDataLocalMicrosoftWindowsHistory"
mklink /J "D:UsersDefaultAppDataLocalTemporary Internet Files" D:UsersDefaultAppDataLocalMicrosoftWindowsTemporary Internet Files"
mklink /J "D:UsersDefaultDocumentsMy Music" "D:UsersDefaultMusic"
mklink /J "D:UsersDefaultDocumentsMy Pictures" "D:UsersDefaultPictures"
mklink /J "D:UsersDefaultDocumentsMy Videos" "D:UsersDefaultVideos"

We also have the Public Directory to fix up links for:

mklink /J "D:UsersPublicDocumentsMy Music" "D:UsersPublicMusic"
mklink /J "D:UsersPublicDocumentsMy Pictures" "D:UsersPublicPictures"
mklink /J "D:UsersPublicDocumentsMy Videos" "D:UsersPublicVideos"

Now in the Users directory we have some links to create as well:

mklink /D "D:UsersAll Users" "D:ProgramData"
mklink /J "D:UsersDefault User" "D:UsersDefault"

And here are the other links for the root C:

mklink /J "C:Documents and Settings" "D:Users"
mklink /J "C:Users" "D:Users"
mklink /J "C:ProgramData" "D:ProgramData"

To include Program Files add this piece of code in as well:

mklink /J "C:Program Files" "D:Program Files"

That is the whole batch file completed. Now before you head off to run it make sure you double & triple check your paths, if you have made a mistake it could result in the loss of your personal data and/or program files. As an example of something that occurred while I was testing this. I had Vista already running in a VM so I booted that to test it, created a new drive which was assigned the driveletter E: which was fine so I modified my batch file copy all files to the E drive. Unfortunately unbeknowest to me when I restarted to get into the Command Prompt it reassigned my new drive to drive D so as a result it tried to copy all my user files to D: which naturally failed, the rmdir /Q /S makes it remove the relevant directories without any user interaction so before I knew it all the files were gone meaning I had to reinstall Windows Vista before running another test, with destination drive set to D:.

To run this anyway you just need to boot from your Windows Vista CD. Select to Repair a installation, select your Windows Vista installation and finally select Command Prompt. Then just navigate to wherever you stored it and run it by typing in the name.

There are a few issues with this method. One of the biggest is the way Windows Vista handles links still. Just like Windows XP it includes them in drive space usage checks. This can be quite annoying as ideally you want to shrink down the Windows Vista drive to a much smaller space since it doesn’t have your user files anymore and only Windows Vista files and Program Files(if you didn’t move them as well). This means that it will keep bringing up the message warning you of low disk space. Unfortunately with Windows Vista’s low disk space warnings there doesn’t appear to be a way to prevent it from checking a single drive. Rather its a all or nothing approach. To disable it you can follow the instructions here. Before doing so it may be a good idea to check this one out the warnings here.

Stay tuned for a proper script to ask questions and do it all for you on the fly.

A word of caution regarding moving your Program Files and ProgramData directories. Windows update will not function properly with them on a separate drive despite the use of hard junction points to link them to the new locations. Whilst there is a fix it is a time consuming one and requires you to make changes for every update that it can be applied to since it can only be applied to updates that require you to restart your computer. For more information you can search for the error code 0x80070011.