Rob van der Woude's Scripting Pages

News Archives 2020 Q3


[ Back to the current news page... ]


RichTextMessageBox.exe has been updated: it will now by default interpret escaped special characters, e.g. \n as newline \t as tab, \u20AC as €
To prevent this behaviour, the new /Literal switch is introduced.


WMIGen.exe had a minor maintenance update.
Minor refers to the "outside" changes, inside I had my work cut out reorganizing the names of classes, properties, controls and event handlers, to prepare for the inclusion of multiple new query editors, besides the current WQL Query Editor.
Unless you're writing PowerShell 7 scripts, there is no need to download this maintenance release if you are already using version


Restart_Ethernet.cmd has been updated: the delay between disabling/enabling the network adapter and checking its new status can be specified on the command line.
• Likewise, Restart_PhysicalNetworkAdapters.ps1 has been updated: the delay between disabling/enabling the network adapter can be specified by the -Delay switch, and if run without elevated privileges it will skip disabling and enabling the network adapters and show only their status.


Restart_Ethernet.ps1 has been updated: the delay between disabling/enabling the network adapter can be specified by the -Delay switch, and if run without elevated privileges it will skip disabling and enabling the network adapter and show only its status.
Yesterday.bat has been updated in an attempt to keep it working for every possible date format.


• Francesco found and corrected a bug in DropDownBox.exe's handling of the /F argument: empty list items were supposed to be removed, but they weren't.

Thanks Francesco


• Thierry Montané sent me a PowerShell script he had downloaded from my site and rewritten to make it work in PowerShell 7.
Since my PowerShell IDE works with PowerShell 5 only, I hadn't noticed yet that PowerShell 7 does not have a Get-WMIObject cmdlet, it has been replaced by the new Get-CimInstance cmdlet in PowerShell 6.
The script Thierry sent me was originaly generated by WMIGen, so I decided to modify the WMIGen generated PowerShell code.
However, simple as this may seem, editing the WMI query in WMIGen's Query Editor proved quite a challenge.
So in the new WMIGen version 10.0.15 you can choose to generate either PowerShell 5 code with Query Editor feature, or PowerShell 7 code without Query Editor feature.
The next release should have the Query Editor available for PowerShell 7 code too.

Thanks Thierry


• Three new, more or less similar scripts were added today: The batch file depends on NETSH and may soon be broken: Microsoft warns it may discontinue NETSH's TCP/IP support in the near future.
The PowerShell scripts should last longer.
All three scripts require elevated privileges.


WeerLive.ps1 is a new PowerShell console script with GUI input window that will show the current outdoor temperature in the Notification Area (a.k.a. System Tray).
It uses the WeerLive KNMI weather API to retrieve the data; note that this is for Dutch weather only.
The API requires a (free) personal/educational or (paid) enterprise API key; to request your key, a basic knowledge of the Dutch language is required.


• I added a Quick-and-dirty ASCII table to my Powershell snippets page.


CaptureDate.exe has been updated: it now accepts wildcards, and can optionally recurse directories.


• Since the problems with quoted trailing backslashes in OpenFileBox.exe seem to persist, despite my premature good news yesterday, I decided to publish an enhanced version of my command line test program TestCommandLineArgs.exe.
It will use 2 methods to parse the command line, first the "traditional" method parsing string[] args and if that fails (which it is assumed to do if one of the parsed arguments contains an escaped doublequote) an alternative using a regular expression on Environment.CommandLine.
For RegEx afficionados, this is what the RegEx pattern looks like:
The code can be used for command line parsing in your own C# projects; in case of reported issues with command line parsing of my C# programs I may ask you to pass the same command line to TestCommandLineArgs.exe and send me the results.


• A known issue with standard C# command line handling is that a doublequoted command line argument with a trailing space will cause the closing doublequote to be escaped, making a mess of the remaining arguments.
Dániel Fegler reported problems (error message "Too many command line arguments") with his batch file using my OpenFileBox.exe with the following command:

OpenFileBox.exe "Doom Engine Files (wad/pk3)|*.wad;*.pk3" "%~dp0" "This is the Title"

A test program I wrote showed me how this command line is interpreted:
5 command line arguments:
[0]     "Doom Engine Files (wad/pk3)|*.wad;*.pk3"
[1]     "D:" This"      (contains doublequote)
[2]     "is"
[3]     "the"
[4]     "Title"
Though the issue was known (doublequoted path with trailing backslash "%~dp0"), and the solution in this case quite simple (append a dot to the path, i.e. "%~dp0."), I kept wondering if I could not solve this in a more elegant way.
Regular expressions to the rescue!
I updated OpenFileBox.exe so now, if it detects too many command line arguments, it will perform an alternative command line check using regular expressions on Environment.CommandLine instead of string[] args
The result is that the command line is interpreted correctly regardless of trailing backslashes and/or doublequotes.
[0]     "Doom Engine Files (wad/pk3)|*.wad;*.pk3"
[1]     "D:\"
[2]     "This is the Title"
Unfortunately, this solution works only for a fixed number of command line arguments, but in this case that's OK.

Thanks Dániel


• James Hudgins reported another error in BatCodeCheck.exe: Unhandled Exception: System.ArgumentException: An entry with the same key already exists. if a variable was set more then once in the batch code.
While testing his case, I found (and corrected) 2 more errors...

Thanks James


RxReplace.exe has been updated: by default, the replacement text will now be unescaped to allow non-ASCII characters in the replacement string.
To prevent unescaping use the optional /L switch to treat the specified replacement string als Literal text.
• The Brasil extension scripts for AirRegGUI.ps1 have been updated.
Nesting these PowerShell scripts proved less reliable than expected, so I now wrote a batch file (kept on my local computer) to automatically recreate AirRegPRCmd.ps1..AirRgPUCmd.ps1 based on AirRegPPCmd.ps1's latest modifications.


• Chris Zanoni reported 2 errors in BatCodeCheck.exe.
Many errors have been reported in BatCodeCheck.exe, mostly false positives on doublequotes or percent signs, which are often hard to fix without introducing new issues.
The errors Chris reported, however, were real bugs, and relatively easy to fix — which I did.

Thanks Chris


• And another minor update for Hardware.hta: I added a "Memory Speed" field and fixed a bug that left WinSat score fields in exported results empty.


• A minor update for Hardware.hta: I added a "Memory Form Factor" field.


• Thierry Montané found a bug in WMIGen's C++ code generator: it would repeat code snippets for array type properties.
I found the cause and corrected the code, and the error seems to be fixed in the new version of WMIGen.

Thanks Thierry


• Another minor update for CountDown.exe: you can now specify message and delay as a single argument, e.g. CountDown.exe "Waiting " 20 " seconds" or CountDown.exe "Waiting 20 seconds" will both work.


CountDown.exe has been updated: you can now specify an optional prefix and suffix message, e.g.

CountDown.exe "Waiting " 20 " seconds"

will show:



• Francesco found a bug in InputBox.exe that would be forgiven by Windows 10 but not by Windows 7: the focus was on the entire form instead of on the input text box.
In the end this required only the removal of a single line of code, but it took a while to find the cause because the problem did not occur in Windows 10.

Thanks again Francesco
AirRegGUI.ps1 had a minor update: an airplane icon, embedded in the script as well as a stand-alone icon file to be used for shortcuts.



Archived News pages
Archived news from 2020
Archived news from 2019
Archived news from 2018
Archived news from 2017
Archived news from 2016
Archived news from 2015
Archived news from 2014
Archived news from 2013
Archived news from 2012
Archived news from 2011
Archived news from 2010
Archived news from 2009
Archived news from 2008
Archived news from 2007



page last modified: 2020-11-15