Fix an incorrect boot drive letter in Windows XP

Okay, here’s the situation. When I first installed Windows XP, I had a flash drive attached to one of my USB ports. This flash drive was assigned the letter C, so my hard drive was assigned E. This had never been a problem until a few days ago when I added another partition to the drive. I had since removed the flash drive, so when the partition table was changed, the drive letter of my Windows installation changed to C, since it was now available.

When I started Windows, it would stick at the welcome screen. This is because all of the paths used by Windows point to the E drive, so windows couldn’t find any of the files it was looking for and therefore couldn’t boot. Unfortunately, at this point I hadn’t yet realized that my drive letter had changed. All I knew is that my system would no longer boot, so I ran a repair install of Windows XP. This took far longer than a normal repair installation. The install was stuck at the “27 minutes to go” point for at least thirty minutes. Once the repair install was complete, I was able to boot into Windows, though it took several minutes to get past the welcome screen. The repair install set all of the Windows paths to point to C, so the system was able to boot, but all of my applications still pointed to E.

The next step was to correct the drive letter of the boot volume. From this article, I found the following instructions (modified slightly for my drive letters):

1. Make a full system backup of the computer and system state.
2. Log on as an Administrator.
3. Start Regedt32.exe.
4. Go to the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
5. Click MountedDevices.
6. On the Security menu, click Permissions.
7. Verify that Administrators have full control. Change this back when you are finished with these steps.
8. Quit Regedt32.exe, and then start Regedit.exe.
9. Locate the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
10. Find the drive letter you want to change to (new). Look for “\DosDevices\E:”.
11. Right-click \DosDevices\C:, and then click Rename.

Note You must use Regedit instead of Regedt32 to rename this registry key.
12. Rename it to an unused drive letter “\DosDevices\Z:”.

This frees up drive letter E.
13. Find the drive letter you want changed. Look for “\DosDevices\C:”.
14. Right-click \DosDevices\C:, and then click Rename.
15. Rename it to the appropriate (new) drive letter “\DosDevices\E:”.
16. Click the value for \DosDevices\Z:, click Rename, and then name it back to “\DosDevices\C:”.
17. Quit Regedit, and then start Regedt32.
18. Change the permissions back to the previous setting for Administrators (this should probably be Read Only).
19. Restart the computer.

Upon reboot, my computer again would not go past the welcome screen. This is because all of the Windows paths now pointed to the C drive, thanks to the repair install, but the boot drive was once again set to E. So now I had to do another repair install of XP in order to get all of the Windows paths to point to the correct drive letter. Fortunately, the repair didn’t take as long the second time as it did the first time. Once the repair was complete, the system restarted and booted perfectly. Everything was as it was with the exception of AVG Free, which wanted me to reenter my license information, which I didn’t have because it’s the free version. A reinstall of AVG fixed this issue.

I’m now keeping my flash drive attached to the computer at all times, just in case I ever change the partition table again. Presumably, the flash drive will retain the C drive letter and the Windows boot partition won’t change.

I’m glad this is over with.

Worky: Time-management script

Here’s a script I wrote to make it very easy to clock in and out for the various projects I work on. I don’t like to have to open an application to do this, so I wrote this script with the intention of making it really fast and easy to clock in/out, describe the work I’ve done on any given day, and generate a report of all work done for a particular bill period. You can download it here:

worky.zip

Top 10 advantages of ADD in a high-tech career

Pete Quily of Adult ADD Strengths covers the advantages of having ADHD in a high-tech career. Among these are “the ability to hyperfocus”, “highly creative”, and “great in a crisis”. While I’ve never been diagnosed with ADHD, I feel like I fit into this category pretty well. He didn’t mention anything about being incredibly good-looking, however. Perhaps a minor oversight.

Read the full article here.

Copy all files except…

Here’s a problem I just came across. I needed a shell script, make_backup, used to copy all of the files in the directory in which the script is located to a backup directory without copying the make_backup shell script itself. I searched online to find the easiest way to do this, but for some reason, the command wasn’t working. Here’s the bash command:

cp -r !(make_backup) $backup_dir

Every time I attempted to execute the shell script, bash gave me an error stating that the ‘(’ was “unexpected”. Searching around on line was telling me that this was a supported bash command, but obviously, it wasn’t on my machine. After some digging, I came to the realization that you have to enable composite patterns in bash for this to work. To do this, place the following line before the “cp” command (I put it in my .bashrc file so I don’t have this problem again):

shopt -s extglob

That’s it! You should now be able to use the extended globbing commands. Read more about it here: http://www.faqs.org/docs/bashman/bashref_35.html

Bienvenue

This is the beginning of my new blog, covering all aspects of computing and technology on all of the platforms. I’ll be covering tips, techniques, and how-to’s that make our lives as computer users easier and more satisfying. This blog won’t focus on a single platform, programming language, or topic. Rather, since I don’t believe there’s a perfect computer platform, I’ll be covering the whole range of topics on Windows, Mac OS X, and Linux - shell scripts, web design, OS tweaks, application programming, and OS interoperability. As an electrical engineer by training, I’ll even throw in some DIY electronics tips. Hopefully, this will help some of you to ease your computer experience. After all, these things are supposed to make our leaves easier. I’m always open for suggestions of topics to cover so feel free to drop me a line if you’ve got some ideas or questions. And if you’ve got a web site that covers similar topics, let me know, and I’d be happy to link to it.

Cheers,

Alex