Rob van der Woude's Scripting Pages

News Archives 2010 Q3


[ Back to the current news page... ]


September 30, 2010 ListWMIClasses.vbs succeeds where ListWMIClasses.bat fails: it lists all available WMI classes.
On my computer, the batch file lists 81 classes for the "root\CIMV2" namespace, the VBScript version lists 1123 classes.
I guess "most" in the description of the batch file was a little over optimistic.
September 29, 2010 ListWMIClasses.bat is a first attempt at listing all WMI classes available in batch (i.e. WMIC). So far, the attempt fails, as the batch file lists only those classes that have an alias in WMIC.
September 28, 2010 • The password dialog script IEPwdDlg.vbs has been updated, it now opens with the focus set to the password input field, and the title bar no longer displays the text "Microsoft Internet Explorer".
Ditto for the other IE dialogs.

• A new version of WANIP.bat has been uploaded; it uses PHP instead of WGET to retrieve your WAN IP address from It is based on a tip by Stan Littlefield.

Thanks Stan
September 27, 2010 • To allow *.chm files to be opened from mapped network drives I wrote CHMFixUNC.bat (*.CHM Fix for UNCs).
It changes the following registry values:


The UrlAllowList value will contain a list of UNCs for all network drives that are mapped when the batch file is run.
It will overwrite existing values, and it won't include UNCs that aren't mapped!
You may prefer a simple *.reg file instead, but the advantage of the batch approach is that it updates the list of allowed UNCs on the fly.
It may or may not work on Windows XP and/or Vista, it has been tested only on my own Windows 7 system.

• The HTA examples page has been updated, in the continuing samples reorganization process. No new scripts have been added since yesterday, though.
September 26, 2010 Hardware.hta has been updated, it now correctly displays multiple monitors and network adapters. I also corrected the download link, it now points to the right source file.
September 24, 2010 • I updated the WMIC page, it now includes examples and notes on listing properties and methods for specific WMI classes.
September 23, 2010 FfxCAC.bat has been updated, it now purges all cache directories used by Firefox in all profiles it has access to.
September 20, 2010 FfxCache.bat has been updated, it now purges all cache directories used by Firefox.
September 17, 2010 Printing.exe has had another, minor update.
This update does not affect the functionality.
I changed the names of namespaces and the casing of variables to make the code more conform to naming conventions, and I used compiler directives for the debugging code to make the resulting executable a little bit smaller in size.
My other C# projects will follow soon.

• You may have noticed the absence of the "Save page as PDF" button and QR code below the menu. I removed them to improve load times of my web pages.
If you want to save any web page as PDF, try PDF995 or doPDF or any other "PDF printer".
September 16, 2010 • Back in 2006, when I wrote NICSpeed.vbs and NICSpeed.kix, the list of network adapters they returned was short, compared to the list I get today.
And since I had not "ported" this script to batch yet, I decided to write NICSpeed.bat, which now only lists active physical Ethernet adapters and their link speed.
Instead of over 15 adapters, I now get a short list of only 2.
The batch file also "optimizes" the output by cleverly choosing to return the speed in either kb/s, Mb/s or Gb/s, whichever is required to return a number in the 1 through 999 range.
September 15, 2010 • You probably expected it any moment now: Printing.vbs.
It has the same functionality the batch and C# versions have.

• My new GetFlashDrivesXP.bat is a modified for XP version of GetFlashDrives.bat.
Like GetCDROMDrivesXP.bat, it queries the registry for a list of "flash" drives.
September 14, 2010 • Both Printing.exe and Printing.bat have been updated.
The batch file got the /List switch too, and (for both versions) no other command line arguments are allowed anymore with /List.

• The next step in reorganizing my script sample pages: the WSH examples have been grouped into a single page. "Only" 401 PHP pages left of the original 500.
Like the batch examples, you may limit the list to a selection by specifying the first character, more or less like it used to be.
And not unlike the batch examples: where the old URL would have been something like, the new URL would be
The old URLs will be redirected automatically: as well as will both direct you to the right script sample.
Filtering by function/category is implemented for the WSH examples too.

GetCDROMDrivesXP.bat has been updated.
Version 1.10 no longer requires DISKPART, but uses a technique similar to GetCDROMDrives.bat for Windows 7, adapted to XP's REG 3.0. As a result, it is much faster than the previous version.
September 13, 2010 • While at it, I "ported" Printing.exe's C# code to Printing.bat.
Where the executable may work in Windows 2000 and XP Home, the batch file uses WMIC, so the minimum required OS is XP professional.
The version numbering started at 2.02 to keep it "synchronized" with the C# version. However, the batch version has already been updated to 2.10: a /List switch has been added.
September 12, 2010 Printing.exe has been updated.
I added the /All switch to act (i.e. pause or resume printing or flush all print jobs) on all printers instead of a single one.
I also solved the error that would occur whenever the executable was called without ".exe" in the command line.
September 6, 2010 • A long time ago, I wrote a rather complex batch file to find the CD-ROM drive letter in Windows 95/98/ME/NT4/2000.
After a tip by Vilnius Rumpleschlaggan I thought it's about time to add an update for more recent Windows versions: GetCDROMDrives.bat.
It uses a simple technique to read the drive letters and drive types from the registry (HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\*). It works in Windows 7, but not in XP, and I did not test it in Vista. It uses REG 6.1's wildcards support, which was not implemented in XP's REG 3.0.
GetFlashDrives.bat uses the same technique to list all removable "Flash" drives.
GetLastDrive.bat uses a similar technique to find the last ("highest") drive letter in use.
And for XP I wrote GetCDROMDrivesXP.bat which uses DISKPART to find the CD-ROM drive letters. It is much slower than its Windows 7 counterpart, but at least it works with XP's REG 3.0.

Thanks Vilnius
September 5, 2010 • Besides limiting the number of pages for my website, one of the reasons behind reorganizing my script sample pages is to allow queries, instead of static lists sorted by name.
The Batch file examples page is the first one to get a button.
By pressing the button, a table with (at this moment) 36 categories is revealed.
To display only the sample scripts in a specific category, click the button, and then check the checkbox for the required category.
If you select multiple categories, all scripts matching at least one of the selected categories will be displayed.
Clicking the button will reveal all scripts again.
Use to hide the list of categories again.
This new filter is "client side" functionality, so if JavaScript is disabled in your browser, you won't get any of this filter functionality, just the plain list sorted by name.
August 31, 2010 • As I wrote before, I am reorganizing my script sample pages. Today the batch examples have been grouped into a single page.
Because the page may take way too long to load, you may load a selection only by specifying the first character, almost like it used to be.
However, where the old URL would have been something like, the new URL would be
But don't worry, the old URLs will be redirected automatically: as well as will still direct you to the right script sample.
August 27, 2010 • I added a paragraph on using Program Directories to detect installed software versions.
Though I would advise against it in most cases, it is the easiest and arguably most accurate way to detect installed .NET Framework versions, including future ones.

• I updated NETFxVer.bat again, it now uses the directories as described above.
Not only is it much faster and more accurate than previous versions, it also differentiates between 32bit and 64bit installations.
August 26, 2010 NETFxVer.bat has been updated.
It will now list all installed .NET Framework versions, even in Windows 7.
August 23, 2010 • Just for fun I wrote Web WhoAmI; it will display something like this:
Your IP address is
Your location is Netherlands (NL)
The PHP code used is available on the Web WhoAmI page.
It is based on's GetGeoIP functionality.
August 20, 2010 • I replaced the screenshot of my Romans.hta by a working HTML/JavaScript version of the Roman Numerals Converter.
August 18, 2010 • With the list of country codes came a list of language codes.
These are the values you may expect to find in the registry value HKEY_CURRENT_USER\Control Panel\International\Locale.
In VBScript, the language code of the local computer can be obtained with the GetLocale( ) function.
August 17, 2010 • As another spin-off, I created a list of country codes.
These are the values you may expect to find in the registry value HKEY_CURRENT_USER\Control Panel\International\iCountry.
It goes without saying that I did not test all values.
I also "embedded" the list in iCountry.vbs, which translates the numeric country code to the (English) country name.
HKEY_CURRENT_USER\Control Panel\International\sCountry also contains the country name, but localized, i.e. in the language specified in HKEY_CURRENT_USER\Control Panel\International\Locale.

WGetTxt.vbs is a WGET inspired script to retrieve a web page and save it (without formatting) as plain ASCII text.
It uses ADODB.Stream to convert the retrieved (Unicode) text to ASCII.
August 14, 2010 • I replaced the screenshot of my Holidays.hta by a working PHP version of the Holidays calculator.
The PHP version is very similar to the HTA, but lacks the Clipboard function and the immediate refresh when a year is selected (it requires clicking a "Refresh" button and reloading the page).
So now you can choose to calculate holiday dates either on-line or off-line — or not at all...

• While at it, I added Spanish to the list of languages supported by Holidays.hta, plus an optional command line argument /LANG:xx to override the default language setting, where xx is DE for German, EN for English, FR for French, NL for Dutch, or SP for Spanish.
August 13, 2010 • Hurray, today is Blame Someone Else Day!
With my Holidays.hta you can calculate when next year's Blame Someone Else Day will be.

• OK, let's get serious now.
I added CRC32Hex.bat on my PHP based batch files page. It returns the CRC32 checksum in hexadecimal for a specified string.
It does require PHP installed on the local computer.
August 8, 2010 • To limit the number of pages for this website, I am reorganizing my script sample pages. All Perl examples have been grouped into a single page, as have all KiXtart examples and Rexx examples. The others will follow.
In time, I intend to replace these lists by queries.

• I added a Scheduled Tasks section to my Unattended Installations page; it briefly explains various techniques to migrate existing Scheduled Tasks or to create new ones.
August 2, 2010 • I added PRINTBRM.EXE to the Printing section of the Unattended Installations page, since PrintMig should not be used on the "current" Windows versions.
August 1, 2010 • Recently I added a page on using PHP in batch files.
Today I added a section on using Perl the same way.
Two samples are included: MD5Perl.bat and SHA1Perl.bat.

• WMI code often is so easy to port: it took me less than 5 minutes to create is6432os.bat by looking at the C# code.
July 30, 2010 • Sometimes SFaR.vbs (Simple Find and Replace) is not enough for the job at hand, so I wrote RFaR.vbs (Regex Find and Replace).
It is not as simple to use, but much more powerful.
A sample of its usage is shown in the Network section of my Unattended Installations page.

StringHash.vbs is the new VBScript version of yesterday's compiled C# version.
The current version is limited to the MD5 and SHA-256 algorithms.
Contrary to the C# version, it does not use .NET. Instead, it uses the MD5 and SHA256 classes by Frez Systems Limited, which were adapted for use in "normal" VBScript by Michal Gabrukiewicz (MD5) and yours truly (SHA-256).
July 28, 2010 • Another spin-off of one of my projects: StringHash.exe returns the MD5, SHA-1, SHA-256, SHA-384 or SHA-512 hash value for the specified string.
Executable and C# source code are included in the ZIP file.

Thanks for cleaning up the code, Bas
July 27, 2010 • I found a new way to strip any number of leading zeroes (or spaces or in fact any character or combination of characters) from a string:

FOR /F "tokens=* delims=0" %%A IN ("%Var%") DO SET Var=%%A
July 26, 2010 SID2User.bat and User2SID.bat are 2 batch files to convert SID to user ID vv.
They use WMIC so Windows XP is the minimum OS required.
July 25, 2010 ListDHCP.bat is a script to list DHCP servers for each network adapter on a computer.
It uses NETSH so Windows XP is the minimum OS required.
July 23, 2010 • I updated GetUnins.vbs, my script to list uninstall commands for all software on a computer, or for a selection.
With the new /T switch the results will be displayed in tab delimited format.
July 21, 2010 • I added several new examples on my PHP based batch files page: ISODate, LastDayOfMonth, UniqueChars and many more.
July 16, 2010 • I added a page on PHP based batch files: how to use powerful PHP features in batch files.
Think cosine, MD5 or decimal to hexadecimal conversion; the possibilities are endless.

• And just to prove it is possible, I wrote Cosine.bat, which uses native Windows commands only to calculate the cosine of an angle in radians.
July 14, 2010 SFaR.vbs is a new Simple Find and Replace script.
It accepts files as well as strings as input, and can modify the original file or save the result to a new file.
Though ASCII oriented, limited testing on XML files suggests UTF-8 is handled correctly as long as no Unicode characters need to be found or replaced.

• I tend to forget XML Starlet's myriad command line options, so I wrote ReadXML.bat, a simple "wrapper" for the functionality I use most often: read a value from an XML file.

• I updated the information on Internet Explorer's command line switches to match IE 8.

• Xavier del Peso Ribera sent me some information he found on running Explorer in a separate process with different credentials.

Thanks Xavier
July 13, 2010 • I wrote Printing.exe to practice C# programming.
It combines PausePrinting and ResumePrinting and adds functionality to cancel all print jobs.
My son Bas has shown a lot of patience in guiding me through this "culture shock" of exact type casting (don't believe the documented return variable types, WMI always returns variables of the object type that need to be casted/converted; compare that to batch files, where everything is a string and almost any string can be used as a command).

Thanks Bas
July 11, 2010 • I wrote PausePrinting.vbs and ResumePrinting.vbs, to pause and resume printing on a specified printer.
Of course, I couldn't resist writing them in batch as well (PausePrinting.bat and ResumePrinting.bat).
July 10, 2010 SortDate.bat Version 5 for XP has been updated to work in Windows 7 too.
July 8, 2010 CheckRegAccess.bat demonstrates how to use WMIC to check registry access permissions.
July 7, 2010 • Today, when Erik Johnson sent me a tip on using the "legacy" MODE command to configure his laptop's keyboard speed, I decided to dedicate a web page to the MODE command.

Thanks Erik

• Stan Littlefield found a bug in my GConv.vbs script (actually in the GoogleUnitConversion( ) function that is used in the script).
The script would break if Google added "prefixes" to the units used, e.g. GConv.vbs 136 gallons in ounces would not return anything because Google returns 136 US gallons = 17 408 US fluid ounces.
I changed the regular expression used to take into account these prefixes as well as spaces or other delimiters in the returned numerical value.

Thanks Stan

• Remember my challenge to enumerate all keys in the root of a registry hive?
We have a winner. Aalok Narkhede found this deceptively simple solution.

Thanks Aalok
July 6, 2010 • News from the gadgets department: I added each page's automatically generated URL QR code in the left margin.

StartHow.bat is a batch file that shows the complete command line of the command that will be issued when a specified file is opened using the START command.
In fact it runs the ASSOC command for the specified file type, then runs the FTYPE on the result and display the end result, resolving the command line arguments.
I found out that on my computer UltraEdit breaks the file association for INI files, so helpful as this batch file may be, don't always believe it blindly.
July 5, 2010 • I used Sitemap.bat to index my web pages and source files in a Google sitemap.
Because it was rather slow, I rewrote it and named the new version SimpleSitemap.bat.
The indexing now takes only a couple of seconds, instead of minutes.
The speed gain comes at a price: an exclude list is no longer supported.
July 4, 2010 • I updated my ListPrinters C# code, it can now run queries on remote computers too.

• A utility I needed for one of my own projects is is6432os, written in C#.
It returns either 32 or 64 as "ErrorLevel" (or 1 in case of an error).
It's easily created in any other language, as it consists primarily of a WMI query on the Win32_Processor class:
  • The AddressWidth property holds the "bit-width" of the operating system
  • The DataWidth property holds the "bit-width" of the processor
So AddressWidth is the property we're interested in.
Take a look at is6432os.vbs to find out how easily the code can be ported.
July 3, 2010 • Still practicing with C#, I wrote ListDrives in C#.
It returns all drive letters in use on a single line.
I also added an optional command line argument to list the drive letters used by a remote computer.
Without my son's assistance I would not yet have come this far.

Thanks Bas
July 1, 2010 KixINI.vbs is a new script demonstrating the use of KiXtart's COM object in VBScript to read and write INI files.

• My son Bas told me countless times that I should move on from VBScript to C# — that's why I added the C# (and VB .NET) support to my WMI Code generator.
To practice a little, I wrote ListPrinters in C#, and the speed of the compiled executable was a pleasant surprise.


Archived News pages
Archived news from 2010
Archived news from 2009
Archived news from 2008
Archived news from 2007


page last modified: 2018-04-16