Windows Scripting
  Home arrow Windows Scripting arrow Page 4 - Working with the Windows Registry in WSH
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 
Mobile Linux 
App Generation ROI 
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

Working with the Windows Registry in WSH
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 14
    2006-08-29

    Table of Contents:
  • Working with the Windows Registry in WSH
  • Putting it Together
  • The WMI Way
  • Other Value Types

  • 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


    Working with the Windows Registry in WSH - Other Value Types


    (Page 4 of 4 )

    As I’ve mentioned, each registry value type has its own read (Get) and write (Set) method. I’ll show you each of those methods now.  Let’s take a look at their syntax.

    object.GetExpandedStringValue Root, Path, Value, Variable

    object.SetExpandedStringValue Root, Path, Value, Variable

    object.GetMultiStringStringValue Root, Path, Value, Array

    object.SetMultiStringValue Root, Path, Value, Array

    object.GetDWORDStringValue Root, Path, Value, Integer

    object.SetDWORDStringValue Root, Path, Value, Integer

    The attributes are the same as we’ve been using except for the following: Array is the variable that refers to an array containing each of the multiple strings in order, and Integer is the variable containing an integer.

    Conclusion

    You can now read, write, and delete from the registry using either the WSH method or the WMI method depending on your needs. No matter what type of scripts you write, being able to work with the Windows Registry can come in pretty handy at times.

    These methods may seem a little tough in the beginning, but try using them a little and you’ll pick up on them in no time at all. I use these methods quite frequently in most of my scripts. These are great techniques when creating scripts for multiple systems. The registry can be used to determine all kinds of useful information such as user names and install directories that may be different from one computer to the next.

    So have fun with these techniques. Build your scripts with better compatibility and more power. Until next time, keep coding!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Working with the registry is one of the most fundamental necessities in the Windows...
       · Nice, well written article. Great for beginners, because it starts at the...
       · Thank you very much. I appreciate your kind words. I've got a lot more of these in...
       · "object.SetDWORDStringValue Root, Path, Value, Integer"returns an errorIt should...
       · Thanks for spotting that typo. Much appreciated.However, it is not necessary to...
     

    WINDOWS SCRIPTING ARTICLES

    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH
    - Advanced Word Object Scripting
    - Reading and Printing Word Documents in WSH
    - 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+





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