Taking Control of System Properties, Startup, and Shutdown

In the final part of a four-part article, you'll learn how to change the location of your startup folders, disable error reporting, and more. It is excerpted from chapter six of the Windows XP Cookbook, written by Robbie Allen and Preston Gralla (O'Reilly; ISBN: 0596007256). Copyright © 2005 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
February 01, 2007
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

6.13 Changing the Location of Your Startup Folders

Problem

You want to change the location of your startup folder to another drive or to another folder.

Solution

Using the Registry

You can turn any folder you want into the folder whose contents will be run on startup. To change the location of the current user’s Startup folder, run the Registry Editor and then:

You can turn any folder you want into the folder whose contents will be run on startup. To change the location of the current user’s Startup folder, run the Registry Editor and then:

  1. Go toHKEY_CURRENT_USER\Software\Microsoft\ Windows\CurrentVersion\Explorer\ User Shell Folders\Startup.
  2. The string value is%USERPROFILE%\Start Menu\Programs\Startup.%USERPROFILE%\refers to C:\Documents and Settings\User where User is the current user. Edit the string value to any folder on your hard disk. It doesn’t have to be a subfolder of C:\Documents and Settings\User. For example, the location can be C:\ YourStartup.
  3. Exit the Registry and reboot.

To change the location of the common Startup folder, go toHKEY_LOCAL_MACHINE\ SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Common Startup. The string value will be%ALLUSERSPROFILE%\Start Menu\Programs\Startup. Change it to any folder you want, exit the Registry, and reboot.

Discussion

When you start XP, it automatically runs programs located in your system’s Startup folders. There are more than one of these folders—one for each account, and one common one for all users. So when the system starts, it runs all programs in the account’s Startup folder and the common Startup folder. The locations of the folders are:

  1. C:\Documents and Settings\User\Start Menu\Programs\Startup where User is the account of the current user
  2. C:\Documents and Settings\All Users\Start Menu\Programs\Startup

Shortcuts to any programs you put in either folder will be run at startup. To stop programs from running, remove their shortcuts from the folders.

You can start XP without it running programs located in your Startup folders. You might want to do this if you’re troubleshooting startup problems and want to see whether programs that automatically run at startup are causing the problems. To bypass the Startup folders, hold down the Shift key while you log on. When the logon dialog box appears, type in your user name and password, then hold down the Shift key and click on OK. Keep the Shift key depressed until the desktop appears.

6.14 Disabling Error Reporting

Problem

Whenever Windows encounters an unrecoverable error, it asks whether you want to report the error to Microsoft. You don’t want to send information to Microsoft, and so want to disable the error reporting notice.

Solution

Using a graphical user interface

  1. Right-click My Computer and choose Properties. The System Properties dialog box opens.
  2. Click the Advanced tab.
  3. Click the Error Reporting button.
  4. Select the button next to Disable error reporting.
  5. Check the box next to “But notify me when critical errors occur.” That way, you’ll still be notified when a critical error occurs, but you won’t be prompted to send the error report to Microsoft.
  6. Click OK.


    Figure 6-9. When turning off error reporting, make sure that you tell XP to notify you when critical errors occur, or else you might not know when applications crash or you run into other problems

If you’d like, you can enable error reporting for some applications and disable it for others. You can, for example, enable error reporting for critical errors having to do with XP itself but not applications, or you can enable error reporting for applications on a case-by-case basis. To do this, from the screen pictured in Figure 6-9:

  1. Select the Enable error reporting button.
  2. Check the box next to Windows operating system if you want to enable error reporting for XP itself. Check the box next to Programs if you want to enable error reporting for applications.
  3. To turn error reporting on and off for individual applications, click Choose Programs. The Choose Programs dialog box, shown in Figure 6-10, appears. To specify programs for which you want to enable error reporting, click the Add button in the top pane and browse for the program. To specify programs for which you want to disable error reporting, click the Add button in the bottom pane and browse for the program. Click OK and then OK again.

Using the Registry

To disable error reporting, open the Registry Editor and go to HKEY_LOCAL_MACHINE\ SOFTWARE\Microsoft\PCHealth\ErrorReporting and edit the DoReport value to 0. Exit the Registry. You may need to reboot in order for the setting to take effect. Edit the value to 1 to enable error reporting.


Figure 6-10.  Select programs for which you want to enable and disable error reporting

You can also use the Registry to turn off error reporting for applications and XP itself on a case-by-case basis. Go toHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PCHealth\ ErrorReporting. Then:

  • To disable error reporting for Microsoft applications, edit theIncludeMicrosoftAppsvalue to 0.
  • To disable error reporting for Windows components, edit theIncludeWindowsAppsvalue to 0.
  • To exclude any individual application from error reporting, create a new DWORD value underHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ PCHealth\ErrorReporting\ExclusionList, and give it the executable name of the application you want to exclude, for example,Notepad.exe. Don’t include the path; just use the executable name.
  • To use error reporting for any individual application, create a new DWORD value underHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ PCHealth\ErrorReporting\InclusionList, and give it the executable name of the application that you want to use error reporting, for example, Notepad.exe. Don’t include the path; just use the executable name.
  • Exit the Registry. You may have to reboot in order for the changes to take effect.

Discussion

Windows Error Reporting (WER) is used to help Microsoft and other developers fix bugs in their programs. If you send an error report after a program crashes, you’re essentially sending a snapshot of your system to Microsoft at the time of the crash. The information is incorporated into a database that includes all the other crash reports that Microsoft has received, and that information is then made available to developers.

By default, error reports don’t contain any identifying information about you or your system, except for what might be inadvertently found on the stack, which is an area of memory used by executing programs and that is included in the crash reports. The stack can contain personal information, depending on what was being done on your computer at the time of the crash. For example, it could potentially reveal your credit card number, the web site you were visiting, and emails you’ve written. However, developers do not get your user name, machine name, or Registry information. Developers that use WER are legally bound to keep any information they find private.

If you’re exceedingly worried about your privacy, you’ll want to turn off error reporting, although no instances of private information being used from it have yet been found.

See Also

For an excellent discussion of error reporting, privacy issues, and an examination of exactly what information is sent in an error report, see the article “Windows Error Reporting Under the Covers,” in WindowsDevCenter at http://www.windowsdevcenter. com/pub/a/windows/2004/03/16/wer.html.

6.15 Creating Environment Variables

 

Problem

You want to be able to add environment variables to XP, so that scripts and certain programs can operate properly.

Solution

Using a graphical user interface

  1. Log in as an administrator (only system administrators can set environment variables).
  2. Right-click My Computer and choose Properties.
  3. Click the Advanced tab and click Environment variables. The environment variables dialog box, shown in Figure 6-11, appears.


    Figure 6-11.  The Environment Variables dialog box lets you see what variable are already set, edit them, delete them, and add new ones
  4. To add a new value, click New in the User variables or System variables area, depending on whether you’re adding variables for all users of the system or just the logged-on user.
  5. In the New User Variable dialog box that appears, type the name for the variable in the Variable name box, and the value for the variable in the Variable value box, for example, TMP for the variable name, and %USERPROFILE%\LocalSettings\Temp.
  6. Click OK until all boxes close.
  7. To edit a value, highlight it, click Edit, change the variable name and value, and click OK until all boxes close. To delete a value, highlight it, click Delete, then click OK until all boxes close.
  8. Usually, changes to values require that you restart your PC, so restart to make sure that the changes take effect.

Using a command-line interface

At the command prompt, use this syntax to set an environment variable:

  > set variablename=variablevalue

For example, to set the variableProgramFilescto the valueC:\Program Files, you’d type this at a command prompt and press Enter:

  > set variablename=variablevalue

That will set the environment variable only temporarily, and only in the command prompt; it won’t affect the rest of the system. To set permanent environment variables, use the GUI as detailed in the earlier part of this recipe.

Discussion

Environment variables that contain information about the environment for the system and/or for the currently logged on user are used for a wide variety of purposes—for example, to determine where to place files such as temporary files, what the root drive is, and where the Windows directory is. They’re often used in scripting as well. Windows contains a variety of environment variables by default, such as defining the root directory and the Windows directory.

If you’re at the command prompt and want to see the current environment variables, typeset and press Enter. You’ll see a list like this:

  PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;. JS;. JSE;.WSF;.WSH
  PROCESSOR_ARCHITECTURE=x86
  PROCESSOR_IDENTIFIER=x86 Family 15 Model 1 Stepping 2, GenuineIntel
  PROCESSOR_LEVEL=15
  PROCESSOR_REVISION=0102
  ProgramFiles=C:\Program Files
  PROMPT=$P$G
  SESSIONNAME=Console
  SystemDrive=C:
  SystemRoot=C:\WINDOWS
  TEMP=C:\DOCUME~1\PRESTO~1\LOCALS~1\Temp
  TMP=C:\DOCUME~1\PRESTO~1\LOCALS~1\Temp
  USERDOMAIN=PRESTONGRALLA
  USERNAME=Preston Gralla
  USERPROFILE=C:\Documents and Settings\Preston Gralla
  windir=C:\WINDOWS

Greating Environment Variables

See Also

MS KB 310519, “How To Manage Environment Variables in Windows XP”

6.16 Creating a Reboot or Shutdown Shortcut

Problem

You want to reboot or shut down your PC quickly, and customize the way that it shuts down.

Solution

Using a graphical user interface

For a fast way to shut down or reboot your PC, create a shortcut on your desktop, and then double-click the shortcut.

To create the shortcut, right-click the desktop and select New -> Shortcut. The Create Shortcut wizard appears. On the first screen, for the location of the item, typeshutdown, followed by one of several switches, like this:

  shutdown -r -t 01 -c "Rebooting your PC"

Click Next, and in the next screen, type in the name of the shortcut. This is what will appear on the shortcut on the desktop. Then click Finish. To shut down or reboot, double-click the shortcut.

The example above would create a shortcut that would reboot your PC after a one-second delay and display the message “Rebooting your PC.” You can instead tell the PC to reboot or you can have it log you off instead of shutting down. Table 6-3 lists the switches you can use withshutdown.

Table 6-3. Switches you can use with shutdown

Switch What it does
-s Shuts down the PC
-l Logs the current user off.
-t nn Indicates the delay, in seconds, before performing the action.
-c“messagetext” Displays a message in the System Shutdown window. A maximum of 127 characters can be used. The message must be enclosed in quotation marks.
-f Forces any running applications to shut down.
-r Restart the PC.

6.17 Scheduling a Reboot

Problem

You want reboot your PC automatically, on a schedule that you specify.

Solution

Using a graphical user interface

  1. Create a shortcut to reboot your PC, as explained in Recipe 6.16. Use this syntax for creating it:

     
    shutdown –r –t 01 –c "Rebooting your PC"
  2. From the Control Panel, open the Scheduled Tasks applet.
  3. Double-click Add Scheduled Task.
  4. Click Next.
  5. In the screen that appears, click the Browse button, browse to C:\Windows\System32 and select shutdown.exe.
  6. Type a name for the task (such as Reboot), select the frequency in which to run it, and click Next.
  7. Enter the username and password of the user the task should run as and click Next.
  8. If you want to go back and modify any of the settings for the task, check the box beside Open advanced properties and click Finish.

Discussion

Some people believe a periodic reboot is required to keep Windows snappy. Indeed, some updates for virus protection and security policies require a reboot to either take effect or poll network resources for updates and policy changes. So it’s a good idea to reboot Windows every once in a while, even if it doesn’t seem as if it’s needed.

See Also

Recipe 10.12 for scheduling a task and Recipe 6.16 for creating a reboot or shutdown shortcut

6.18 Speeding Up System Startup

Problem

You want your system to start more quickly.

Solution

Perform a boot defragment

Doing a boot defragment will put all the boot files next to one another on your hard disk. When boot files are in close proximity to one another, your system will start faster. On most systems, boot defragment should be enabled by default, but it might not be on yours, or it might have been changed inadvertently. To make sure that boot defragment is enabled on your system, run the Registry Editor and go to HKEY_LOCAL_ MACHINE\SOFTWARE\Microsoft\Dfrg\ BootOptimizeFunction. Edit the Enable string value to Y if it is not already set to Y. Exit the Registry and reboot. The next time you reboot, you’ll do a boot defragment.

Edit your BIOS

When you turn on your PC, it goes through a set of startup procedures in its BIOS before it starts XP. So, if you speed up those initial startup procedures, you’ll make your system start faster.

You can speed up your startup procedures by changing the BIOS with the built-in setup utility. How you run this utility varies from PC to PC, but you typically get to it by pressing the Delete, F1, or F10 key. You’ll come to a menu with a variety of choices. Here are the choices to make for faster system startups.

Quick Power-On Self Test (POST)
   When you choose this option, your system runs an
   abbreviated POST rather than the normal, lengthy
   one.

Boot-Up Floppy Seek
  
Disable this option. When it’s enabled, your system
   spends a few extra seconds looking for your floppy
   drive—a relatively pointless procedure, especially
   considering how infrequently you use your floppy
   drive.

Boot Delay
  
Some systems let you delay booting after you turn
   on your PC so that your hard drive gets a chance to
   start spinning before bootup. Most likely, you don’t
   need to have this boot delay, so turn it off. If you run
   into problems, you can turn it back on.

Clean out your Registry

Over time, your Registry can become bloated with unused entries, slowing down your system startup because your system loads them every time you start up your PC. Registry First Aid (http://www.rosecitysoftware.com/Reg1Aid) can help you delete unneeded Registry entries and speed up startup times. It combs your Registry for outdated and useless entries, and lets you choose which entries to delete and which to keep. It also creates a full Registry backup so that you can restore the Registry if you run into a problem.

See Also

Registry First Aid is shareware and free to try, but it costs $21 if you decide to keep using it. Download it from http://www.rosecitysoftware.com/reg1aid.

Another cause of system slowdown is services that run on startup that you don’t need—for example, the Wireless Zero Configuration Services running on a desktop computer that doesn’t use a wireless adapter and is connected to a network via an Ethernet connection. For details, see Recipe 6.7.

blog comments powered by Disqus
WINDOWS SCRIPTING ARTICLES

- More Windows Scripting Workarounds from Nilpo
- Overloading Methods and More in VBScript
- Improving MFC for Windows Vista
- Regular Expressions in VBScript
- Working with Dates in WMI
- Completing Calendars with VBScript Date Func...
- Building Calendars with VBScript Date Functi...
- Working With Dates and Times in VBScript
- Designing WCF DataContract Classes Using the...
- Understanding Dates and Times in VBScript
- Working With Arrays in VBScript
- Compressed Folders in WSH
- Using .NET Interops in VBScript
- Nilpo`s Scripting Secrets, Vol I
- Database operations using Silverlight 2.0 WC...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials