Everything you wanted to know about BCDEdit

Microsoft has published a typically exhaustive FAQ that explains how to use the new Boot Configuration Data Editor (Bcdedit.exe). The Boot Configuration Data store replaces boot.ini, the text file that manages startup settings for older versions of Windows, including Windows XP. This command-line utility is strictly propellerhead stuff. If you run one version of Windows Vista, as most people will, you’ll never need to see or work with the BCD store.

If you set up a multi-boot system with two or more versions of Windows Vista, you’ll need to use Bcdedit to change the startup menu so you can see which version is which. (By default, each entry gets the same descriptive text, which makes it less than useful.)

The easiest way to change the boot menu entry is to do so for the current operating system, like this. Remember, these intructions are only for Windows Vista:

  1. On the Start menu, click All Programs, open the Accessories folder, and then right-click Command Prompt.
  2. Choose Run As Administrator. (If you skip this step, you’ll be running as a regular user and won’t be allowed to change the BCD store.)
  3. In the Command Prompt window, type the following command:

    bcdedit /set {current} description “your menu description

    Note that those are curly braces in the parameter after /set, and you should of course replace the italicized text with whatever you want to display for the actual startup menu text.

To edit menu descriptions for an operating system choice other than the current one, you need to find the GUID for that entry and substitute it in the parameter after /set. It’s much easier just to boot into the other OS and use the same command to reset that description.

Tip of the day: Customize Disk Cleanup tasks

Last week I explained how to schedule the Disk Cleanup utility to perform basic maintenance tasks. But the Disk Cleanup utility can be overkill, and in some cases you might not want it to run through all its options. How can you tell it you just want it to just clean out the Windows Temp folder? The answer is found in some amazingly useful command-line switches that most Windows users know nothing about. (They’re documented in Windows XP Inside Out and in Knowledge Base article 315246, How to Automate the Disk Cleanup Tool in Windows XP.)

To control how the cleanup process works, you need to first know the executable command for the Disk Cleanup utility, cleanmgr.exe. Then you need to learn to use the following switches to modify its behavior:

  • /D driveletter  Runs Disk Cleanup using the drive letter you specify in place of driveletter (for example, type cleanmgr /d c:, to apply the utility to drive C). (This option is ignored if you use the /Sagerun switch.)
  • /Sageset:n  Opens a dialog box that lets you select Disk Cleanup options, creates a registry key that corresponds to the number you entered (where n is an arbitrary number from 0 through 65535), and then saves your settings in that key.
  • /Sagerun:n  Retrieves the saved settings for the number you enter in place of n and then runs Disk Cleanup without requiring any interaction on your part.

To put all the pieces together, follow these steps:

  1. Click Start, Run (or open a Command Prompt window) and type the command cleanmgr /sageset:200. (This number is completely arbitrary; you can choose any number from 0 through 65535.)
  2. In the Disk Cleanup Settings dialog box, choose the options you want to apply whenever you use these settings. In this example, I’ve cleared all the check boxes except the one in front of Temporary files.

    Cleanmgr

  3. Click OK to save your changes in the registry.
  4. Create a shortcut that uses the command cleanmgr /sagerun:200. Save the shortcut in the Windows folder using a descriptive name – Clean Temp Files, for instance.
  5. Open Control Panel’s Scheduled Tasks folder and start the Add Scheduled Task Wizard. When prompted to select the program you want Windows to run, click Browse and select the shortcut you just created. Follow the wizard’s remaining prompts to schedule the command to run at regular intervals.
  6. Repeat steps 1–5 for other Disk Cleanup options you want to automate.

That’s it. As long as the Task Scheduler service is running, your cleanup chores will be handled automatically on the schedule you specified.

Tip of the day: Schedule routine maintenance

Last week, I showed how to clean out your Windows Temp folder properly.

Today’s tip is a follow-up to that item, showing how you can schedule some routine maintenance chores to be performed automatically.

The secret is buried in the Scheduled Tasks folder, which you can find in Control Panel. (It’s in the Performance and Maintenance group, if you use the Category view of Control Panel.)

Open the Scheduled Tasks folder and double-click Add Scheduled Task. This launches the Scheduled Task Wizard, which walks you through the process of creating a new task. After you get past the opening screen, you’ll see a list of available programs on your PC. Select the Disk Cleanup entry and click Next.

Enter a name for the task (the default should work just fine in this case) and specify how often you want the task to run – daily, weekly, etc. The next secreen in the wizard varies, depending on the option you choose. This screen, for instance, shows a task that has been scheduled to run once a week – at 2:30 AM every Monday.

In the next screen, enter the user name and password of the account whose credentials you want the task to use. This data (which is saved in encrypted format) allows a scheduled task to run even if you’re not logged on. It also allows a task that requires administrative privileges to run when a user with a limited account is logged on.

Finish the wizard to save the scheduled task.

Follow-up: I’ve put together instructions to help you customize the Disk Cleanup task so it performs only the options you want it to run.

Tip of the day: Find out whether you have an OEM copy of Windows

In the comments to a post entitled Everything you always wanted to know about Windows Product Activation, Tim asks:

How do you tell if a product has an OEM vs Retail install? … I have some integrated computers I am responsible for and when I call tech support, they sometimes ask which version of XP/2000 I am running, OEM or Retail.  I got thrown into this and the last guy didn’t keep up with things very well…any help is appreciated!

It’s easy to tell once you know where to look. Right-click the My Computer icon and choose Properties. (You can reach the same destination by starting in Control Panel and double-clicking System.) On the General tab of the System Properties dialog box, under the “Registered to” heading, you’ll see a product ID, which is divided into four groups of characters separated by hyphens. On an OEM installation, the second group of characters is always OEM; on a retail installation, you’ll see three numbers in this group.

That might be your only OEM fingerprint on a computer built in-house or by a “white box” system maker. But for systems from larger PC makers, including the so-called royalty OEMs, you should also see a product logo and the words “Manufactured and supported by” followed by the name of the company that built the PC. Here’s an example:

Oem_properties

One other piece of advice: If you’ve inherited a group of computers and don’t have a handy index to identify the product ID required to reactivate each one, use the wonderful Keyfinder utility to dig out Windows and Office keys, which you can copy to a database or print out and save for future reference. I first wrote about Keyfinder back in December 2002, and it’s still one of my most popular pages.

Tip of the day: Clean out your Windows Temp folder properly

Excel whiz John Walkenbach inspired today’s tip with this post:

I haven’t looked at my Windows \temp directory in a long time. I used to be pretty good about keeping it cleaned out, but I’ve ignored it lately. I just looked at it and found that it contains

  • 4,272 files
  • 95 folders
  • 721Mb

Yikes! Shouldn’t this stuff should be deleted by the apps that placed them there?

Well, yes and no. I just checked this system and discovered 95MB of disk space in use by 496 files and 103 folders, most of them empty. The entire collection dates back about 60 days, which must be the last time I cleaned out temp files.

Some of those files were ones I created or downloaded. (Putting them in the Temp folder is the best way of dealing with files you are positive you won’t want to keep.) When I play a media file directly from a browser or view a Word document or PDF page in the browser window, the downloaded WMV or DOC or PDF file is saved in my Temp folder. Microsoft Office creates a bunch of temp files as it works to keep track of changes and enable its automatic recovery features. I don’t bother deleting these files manually after I’m done, and I don’t expect any program to aggressively clean them up either. The whole idea of the Temp folder is to serve as a junk drawer for files, and any program that puts a file there should assume it’ll get tossed out with the trash sooner rather than later when I empty the Temp folder.

Here are three ways to do just that:

  • The hard way: delete files manually using Windows Explorer. As J-Walk discovered, Explorer quits abruptly as soon as you encounter a file that’s in use – and at least on my computer the Temp folder is usually filled with a dozen or more files in use. To avoid hitting one of those files, display the folder’s contents in Details view and then sort by date. That way you can delete files in groups. Select the oldest files and delete them, then select a newer group of files and delete those, until you get to a group that includes some files in use. At that point you can stop. You’ve probably cleaned out all that you can do.
  • The easier way: Use the Disk Cleanup Wizard. Click Start, All Programs, Accessories, System Tools, Disk Cleanup. Pick a drive, click OK, and wait for the quick analysis. Click OK again, and you’ll empty the Recycle Bin, clear out Internet Explorer’s cache, and empty all files from the Temp folder that are more than a week old.
  • Disk Cleanup wizard

  • The really easy way: Create a Scheduled Task to have your system clean out your Temp folder and perform other cleanup chores automatically. If you poke around in the Scheduled Tasks folder, you’ll see that this option is available with a wizard’s help.

To learn how you can schedule this bit of routine maintenance to run once a week (or on any schedule you prefer), see this tip.

Tip of the day: Unclutter your desktop

There are all sorts of good reasons not to store files on your desktop. One reason you might not be aware of is that the Windows System Restore feature monitors the desktop. If you download an executable file (such as a driver update or a program you’re planning to install) and store it on the desktop, it will be summarily deleted if you use System Restore to roll back your configuration to a time before you saved that file.

Yesterday, I explained how I use the desktop as a temporary holding area for downloads. Here’s how to use the same basic principle for other types of files that tend to clutter up the desktop.

  1. In your My Documents folder, create a subfolder and give it a descriptive name (like Unfiled or Shoebox).
  2. Right-click the icon for the folder you just created and choose Copy. Go to the desktop (knowing one of these shortcuts makes this task much easier), right-click any empty space, and choose Paste Shortcut from the shortcut menu.

You’ve now got a handy place to file stuff you no longer need but can’t bring yourself to toss or file properly. Drag web shortcuts, documents, and other files onto this target to move them to the Unfiled folder. To view the contents of that folder, just double-click the shortcut icon on the desktop.

See also Tip of the day: Keep a clean desktop

Tip of the day: Keep downloads off your desktop

Last year, I explained my strategy for keeping downloaded programs organized.

It’s terribly convenient to download programs directly to the desktop. The trouble is, it’s also terribly convenient to leave them there, and after a few months the desktop is littered with inscrutable shortcuts. Today, I’ll explain how you can use the desktop as a temporary holding area for downloads without turning it into a cluttered mess.

To start, follow the first step I recommended in Get your downloaded programs organized and create a Downloads folder in your My Documents folder (or, if you want downloads to be available to other computers on your network, create a Downloads folder in your Shared Documents folder).

Next, right-click the icon for the Downloads folder and choose Copy. Go to the desktop (knowing one of these shortcuts makes this task much easier), right-click any empty space, and choose Paste Shortcut from the shortcut menu.

You’ve now got a Downloads shortcut on your desktop. As a shortcut, it works exactly like the original folder. When you drag a file or folder onto that icon, it’s moved or copied to the Downloads folder instantly. Here’s how to use this shortcut to keep clutter under control:

  • Every time you download a new program, patch, or utility, go ahead and save it to the desktop.
  • Create a shortcut to the Web page for that download, too. From IE6 or IE7, right-click the page and choose Create Shortcut to instantly create a shortcut on the desktop. Firefox users can drag the page icon at the left of the Address bar and drop it on the desktop, or use the deskCut extension.
  • If you received a serial number or product key with your download, save that information as a text file on the desktop as well.

All the pieces of your download are now on the desktop. If you’re comfortable with using your Downloads folder as a shoebox, select the files and drag them onto the Downloads shortcut. If you’d rather be more organized, create a folder on the desktop first (right-click any empty space and choose New, Folder) and give it a descriptive name that makes it easy to find your download. Now drag the files from your desktop onto that folder and then drag the folder onto the Downloads icon.

Tip of the day: Safely discard SP2 uninstall files

Via e-mail comes an excellent question from Mark Holmes:

Is there any reason to have to keep SP2 uninstall info on my C: drive? I’ve been using SP2 for over 6 mos. I could save about 302MB on my C: drive by deleting it. Just wondered if that would be ok to do.

It took me a few minutes to find the files that Mark was referring to. The first two computers I looked at were running Windows XP Media Center Edition 2005 and Windows XP Tablet PC Edition, both of which were released after SP2 with all SP2 fixes included in the initial setup. The third computer I looked at was more helpful, because I had set it up using the original release of Windows XP, with SP2 added on as a separate step.

On all three computers, opening the %SystemRoot% folder (typically C:\Windows) in Windows Explorer reveals the presence of a large number of hidden folders whose names begin and end with dollar signs. In the screen snippet below, I’ve configured Windows Explorer to show hidden and system files. I can also tell by the blue text in the folder listing that every one of these hidden folders is using NTFS compression.

hotfix and sp uninstall files

The $NtServicePackUninstall$ folder contains files that are used if you decide to uninstall SP2, as documented in Knowledge Base article 875350: How to remove Windows XP Service Pack 2 from your computer. The folders whose names begin with $NtUninstall perform similar functions for individual hotfixes. If you allow Automatic Update to install SP2 or a hotfix, there’s no way to avoid creating this archive, nor is there any way to prevent similar (albeit smaller) archive folders being created when you download and install a hotfix via Windows Update or Microsoft Update. If you download the full installation package, you can use the /n switch as documented here to avoid saving uninstall files.

Each hidden compressed folder contains uninstall instructions and some backed-up files needed to roll back your system to its configuration before you installed that update.

If you want to remove any or all of these hidden folders, you can do so safely, as long as you’re certain you’ll never want to remove SP2. Just delete the folder from Windows Explorer. You could also do the same with the uninstall folders for hotfixes – but again, only if you’re certain you’ll never want to uninstall the associated hotfix. I don’t recommend doing this unless, like Mark, you’re extremely pressed for disk space and upgrading to a bigger hard disk isn’t an option.

Deleting these folders doesn’t affect the shortcuts in the Add Or Remove Programs dialog box. However, if you try to remove an update listed here after deleting its uninstall information, you’ll get an error message and an offer to remove the associated item from the list of installed updates.

Caution: If you go on a search-and-destroy mission for other Service Pack files to remove, you might stumble across %SystemRoot%\ServicePackFiles, which contains the actual downloaded files for SP2. Do not delete these files; they’re essential for Windows File Protection to automatically repair system files if they become corrupted or replaced by an incorrect version.

Tips to return Monday

For those who have been wondering about the Tip of the Day feature, I have good news: It’ll be back on Monday.

As always, I’m trying to come up with fresh information and new perspectives on Windows features that you might already know but aren’t expert on.

I’ve got some ideas in the hopper that I hope you’ll find interesting. Stay tuned.

If you subscribe to the full feed for this site, you’re already getting the tips. No need to change anything. If you want the tips and nothing else in your RSS reader, use this RSS feed.

Get details about the Blue Screen of Death

In the comments on a post from early last year, How to troubleshoot the Blue Screen of Death, Al expresses a common frustration:

My PC has crashed a couple of times now to a BSOD with a stop error I can’t read quick enough. I see nothing in event viwer, is there any other log of what happened? What the stop error was and what the 4nvd.dll (possibly!) or whatever it was that flashed past is?

Information about a stop error (aka BSOD) should appear in Event Viewer’s System log. If you can’t find it there, try reconfiguring your system to stop after a stop error (what a concept!) so you can read the error on the screen. Here are the step-by-step instructions:

  1. Open the System option in Control Panel.
  2. On the Advanced tab, under the Startup and Recovery heading, click the Settings button.
  3. In the Startup and Recovery dialog box, under the System Failure heading, clear the Automatically Restart check box.
  4. Click OK to close the Startup and Recovery dialog box, and then click OK to close the System Properties dialog box.

After making this change, you’ll find that the details of a (hopefully rare) BSOD will remain on screen for you to study and write down. You’ll need to press a key to clear the screen and restart the computer.