|June 27, 2011||• A bug in WANIP.exe has been fixed (corrected a typo in the second URL to try if the first one would fail).|
|June 25, 2011||• Two minor bugs in Hardware.hta's interface have been fixed.
• A minor update to Paste.exe: the help screen explains the errorlevels better than before.
|June 22, 2011||• A potential bug has been fixed in WANIP.exe: the original version used a regular expression
Since only an IP address should be returned, and nothing else, I changed the regular expression to
|June 21, 2011||• StarDateXP.bat is an update of the earlier NT version; the new version uses WMIC to read the current date and time.
It will save its result in environment variable
|June 20, 2011||• WANIP.exe returns the computer's WAN IP address.
It uses 3 different URLs to try and get the address, and it is much faster than my VBScript version using Internet Explorer (unless the URLs all fail to return an IP address).
With the following code, it can be used in a batch file:
• Paste.exe reads and displays text from the clipboard.
I wrote it to use it in conjunction with the latest Hardware.hta version:
Hover over any part of the commands to display a short explanation.
|June 19, 2011||• Hardware.hta has been updated once more: a minor bug (?) fix (impatient users can no longer render the buttons disabled), and some command line switches were added to allow unattended use of the HTA.|
|June 16, 2011||• WMI lists SATA harddisks as IDE, which makes inventories unreliable or of little use.
My latest script, DiskTypes.vbs, is my first attempt at overcoming this limitation. It finds the harddisk controller for each harddisk and CDROM drive, and searches for the words "SATA", "S-ATA" or "Serial ATA" in its Description field.
Not the most reliable method, I agree, but the least unreliable I know that can be used in scripts.
Note that some controllers (usually the ones with RAID capabilities) are incorrectly recognized as SCSI controller, as is the case on my own computer (HDD4, which is identical to HDD0 and HDD3):
HDD0 WDC WD20EARS-00MVWB0 SATA 1863 GB HDD1 WDC WD10EACS-22D6B0 SATA 932 GB HDD2 ST31500541AS SATA 1397 GB HDD3 WDC WD20EARS-00MVWB0 SATA 1863 GB HDD4 WDC WD20 EARS-00MVWB0 SCSI Disk Device SCSI 1863 GB HDD5 Generic USB SD Reader USB Device USB 0 GB HDD6 Generic USB CF Reader USB Device USB 0 GB HDD7 Generic USB xD/SM Reader USB Device USB 0 GB HDD8 Generic USB MS Reader USB Device USB 0 GB CDROM0 PLEXTOR BD-R PX-B920SA SATA I: CDROM1 HL-DT-ST DVDRAM GH22NS40 SATA J:
• Basic Hardware Inventory (Hardware.hta) has been updated with the very same code used in DiskTypes.vbs, so it too now differentiates between IDE and SATA interfaces for harddisks and CDROM drives.
|June 15, 2011||• Basic Hardware Inventory (Hardware.hta) has been updated: it now supports up to 8 harddisks, and up to 4 video cards, monitors and network adapters.|
|June 14, 2011||
• I just returned from a vacation on the isle of Texel, where my camera worked overtime trying to capture all the beautiful birds that can be found there.
It may take a while to answer all e-mail...
• Several improvements have been made to WMIGen.hta: updated and improved C#, Python, Ruby and VB .NET code, more command line options, and a help popup screen when F1 is pressed.
|May 30, 2011||• I added Good Friday to my Holidays Calculator HTA; and it now also supports Italian and Portuguese.|
|May 19, 2011||• I added F# to WMIGen.hta's list of "export formats".
I also added the new
If no command line switch is used, the settings normally done on the command line can be altered interactively. With the
|May 18, 2011||• If you can't find it, write it yourself: TranslateCulture.exe lists translations of weekdays and/or month names for the specified languages ("cultures" in MS speak).|
|May 17, 2011||• I added Groundhog Day to my Holidays Calculator HTA.|
|May 16, 2011||• GetMyPID.exe returns an errorlevel equal to the calling batch file's PID.
It uses Jared Barneck's ParentProcess class.
To get a batch file's PID requires only two lines of code:
• More maintenance on the web server tomorrow night:
|May 14, 2011||• Justin Goldspring found a bug in Brian Williams' Multiply.cmd (multiply big numbers), which Brian corrected immediately.
Thanks Justin and Brian
• Carlos M. updated his A2U.bat (ASCII to Unicode), to allow non-ASCII characters in file names.
|May 13, 2011||• Don't forget: today is Blame Someone Else Day.|
|May 12, 2011||• Brian Williams successfully debugged his GetTitle.bat.
The new version passed all tests in XP and Windows 7.
|May 11, 2011||• Brian Williams updated and improved his GetTitle.bat.
The new version passed the multiple simultaneous instances test in XP, and almost passed (8 or 9 out of 10 correct) in Windows 7.
I think the difference is caused by my test computers: the Windows 7 computer is really fast, whereas the XP computer is a slow virtual machine.
Brian uses the hundredths of seconds as random number, which fails to be unique if 2 or more consoles are opened within 10 milliseconds.
For everyday use, the batch file will perform flawlessly, unless you schedule it to start simultaneously at exactly the same moment.
Thanks Brian, and congratulations.
• Carlos M. sent an updated GetTitle.bat.
The executable it generates is even smaller than the previous version's.
• WaitASecond.exe is a small utility written in C# to get a random delay of 900..1100 milliseconds.
|May 10, 2011||• Carlos M. sent me his script to read its own console window title.
As it generates temporary VBScript code and even an executable, it doesn't qualify for the challenge. It does, however, pass the multiple simultaneous instances test.
• I updated GetTitle.exe: its new
• While on the subject, I found the PowerShell command to read the console window title.
|May 9, 2011||• Remember the real life batch challenge?
I challenged you to write a batch file that will read its own console window title.
After reviewing the first results I added some extra requirements: it should also work when multiple console windows are open, and preferably even when multiple instances of the batch file are running.
Several batch scripting gurus sent me their working code, and I tested each script in Windows 7 Ultimate SP1 (64-bit) and Windows XP Professional SP3 (32-bit).
The source code and test results can be found here.
I would like to express my gratitude to all "contestants" for sharing their inspiration - thanks.
|April 22, 2011||• IsFAT.exe and IsNTFS.exe check if a specified drive is FAT(32) or NTFS formatted.
True scripters would, of course, use WMI, but that wasn't available on my laptops.
I replaced the over 60KB of code by Google's reCAPTCHA Mailhide CAPTCHA generator.
• I made a typo in the code accompanying Carlos M.'s ASCII to Unicode solution. Thanks Jens Ulrik Jacobsen for finding and correcting it.
|April 14, 2011||• WGetLite.exe is a (very) limited WGET version.
It can be used to display or download text (including HTML) files using HTTP.
• RC.bat is a simple batch file written to help me testing scripts and programs; it shows the return code or errorlevel returned by the specified or last command.
It can be used in two ways:
|April 13, 2011||• Tonight some maintanace will be done on the web server:
Quick, get yourself a copy of TimeShift.bat and calculate when the downtime period will be in your own local time.
Or use PingSite.exe to find out...
• GetTxtType.vbs reads a text file's BOM to find out its text encoding (e.g. Unicode 16 BE, or UTF-8, etcetera).
|April 12, 2011||• A minor update to IsDST.bat: it performs more validity checks on the specified date and time, and displays specific error messages besides the help text.
• IsDate.bat is derived from IsDST.bat.
IsDate.bat checks the validity of a specified date. It uses
• And a minor update for PingSite.exe: the
|April 11, 2011||• A bug has been fixed in IsDST.vbs and GMT.vbs.
• A message from Stan Littlefield made me realize that the help text for TimeShift.bat did not make much sense, to say it politely (except maybe to me), so I modified it.
Let me explain: the batch file's goal was to calculate when a USA based web-seminar would start in my local time (Europe/Amsterdam) when its web page mentioned April 9, 2011, 9:00 PM PDT as its start date and time.
So the batch file's first argument is my local time zone, the rest contains the remote date/time and time zone.
The date/time returned are for the local time zone.
• I finally managed to get IsDST.bat working.
It did require some really dirty workarounds, like changing the system date up to 65 times to find the DST and Standard Time start dates (all because there is no real batch nor WMI equivalent for the WSH
Like the VBScript version, the batch file ignores the "ambiguous hour" right after the transition to Standard Time.
Besides the usual caution, be aware that changing the system date can sometimes block domain access or in rare cases even revoke software licenses.
This batch file was written as a proof of concept; use the VBScript or C# version for real life situations.
|April 10, 2011||• Max.bat and Min.bat return the highest and lowest value respectively from a list of (signed) integer values on the command line.
• IsDST.vbs is a script that checks if the current or specified date is in Daylight Saving Time.
The result is displayed on screen and returned as errorlevel (0 if in DST, 1 if not).
• GMT.vbs returns the Greenwich Mean Time for the specified date/time.
It reuses much of IsDST.vbs's code.
|April 9, 2011||• Like many of my scripts, TimeShift.bat was born because I needed it myself.
It translates a date/time for a different time zone to local time (or time for any other specified time zone).
It requires PHP 5.2 or later.
|April 8, 2011||• A bug was fixed in PingSite.exe: the beep now actually works as expected.
If specified, it will beep on errors too.
The 404 error handling has been improved as well.
|April 7, 2011||• Wolfgang Eitel discovered some undocumented command line switches for Foxit Reader:
• As promised yesterday, PingSite.exe has been updated: if the optional
If an interval is specified, the last response code will also be displayed in the window title.
And last but not least: the returned code will be displayed in red if it does not match the expected code.
A slightly modified example of the (tab delimited) output for the
|April 6, 2011||• As I said before, many scripts (and programs) see the light because I need them myself.
PingSite.exe is no exception: my web server has intermittent problems (500 and 503 errors), but when I call the helpdesk it behaves itself just for a while, so I want to monitor it closely.
PingSite.vbs came close to what I needed, but instead of modifying it I rewrote it in C#.
PingSite.exe returns the HTTP response code for the specified URL, or if the optional
I also added an optional
An optional beep may be added later.
An example of the (tab delimited) output for the
|April 4, 2011||• isDST.exe is a small utility written in C#.
It returns an errorlevel 0 if a specified date is in Daylight Saving Time, 2 if not, or 1 in case of (command line) errors.
I have tried to write it in batch, and I still believe it is possible, but it became far too complex. The essential DST check in C# is only about 3 lines of code...
But for those who want to try: I used WMIC with
• CapsLock.exe, NumLock.exe and ScrollLock.exe are 3 "ports" of earlier (VB) utilities to C#.
All three of them return an errorlevel 0 if the key lock is off, 2 if on, or 1 in case of (command line) errors.
Adding optional parameter 0 sets the key lock off, 1 sets it on.
|page last uploaded: 2018-04-16, 10:52|