Reading the Name of the Display Adapter

This Web-exclusive sidebar contains a real-world example of a While...Wend statement. You can learn how to write a script that accesses the system.ini file in Windows 9x.

Dino Esposito

August 31, 1999

1 Min Read
ITPro Today logo in a gray background | ITPro Today


In Windows 9x, you can access system information more easily in the system.ini file than in the Registry. An .ini file has sections, each of which consists of a sequence of entries. Each entry has a name that is unique to the section (however, the same entry name might appear in different sections) and a value that follows an equals sign (=). Square brackets ([ ]) surround the section names. For example, a section with two entries looks like

[section.name]entryname1 = valueentryname2 = value

You can use VBScript code to access system information in the system.ini file. For example, suppose you want to read the names of the video display adapter (i.e., video card) on various workstations. As Listing A shows, you can write a script that scans the system.ini line by line to locate the display.drv entry within the [boot.description] section.

The script in Listing A uses the FileSystemObject object to open and work with the system.ini file. Because this file can have multiple entries with the same name, the script in Listing A uses the While...Wend statement with an embedded If...Then...Else statement to search for the display.drv entry under [boot.description].

After the script finds the display.drv entry, it passes the line to a user-defined function that unpacks the string and extracts the name of the video display adapter.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like