Windows Scripting
  Home arrow Windows Scripting arrow Page 3 - Taking Control of System Properties, Start...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Taking Control of System Properties, Startup, and Shutdown
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2007-02-01

    Table of Contents:
  • Taking Control of System Properties, Startup, and Shutdown
  • 6.14 Disabling Error Reporting
  • 6.15 Creating Environment Variables
  • 6.16 Creating a Reboot or Shutdown Shortcut
  • 6.17 Scheduling a Reboot
  • 6.18 Speeding Up System Startup

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Taking Control of System Properties, Startup, and Shutdown - 6.15 Creating Environment Variables


    (Page 3 of 6 )

     

    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”

    More Windows Scripting Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Windows XP Cookbook," published by...
     

    Buy this book now. This article is excerpted from chapter six of the Windows XP Cookbook, written by Robbie Allen and Preston Gralla (O'Reilly; ISBN: 0596007256). Check it out today at your favorite bookstore. Buy this book now.

    WINDOWS SCRIPTING ARTICLES

    - Scripting Microsoft Word
    - Using WSH to Catalog MP3 Files
    - Reading MP3 ID3 Tags in WSH
    - A Brief Look at Menus in WPF
    - More Examples of Simplified Image Processing...
    - Completing a WPF To-Do List Application
    - Simplified Image Processing in GDI+
    - Data Converstion and Task Addition with WPF
    - Adding Controls to an Application with WPF
    - A Portable Scripting Toolbox
    - WPF Through an Example: Introduction
    - Beginning SharePoint Web Part Development
    - More Alternative Languages for WSH
    - WPF Control Layout
    - WSH in Other Languages





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT