Rob van der Woude's Scripting Pages

News Archives 2012 Q3


[ Back to the current news page... ]


September 30, 2012 EXIFInfo.bat is a first attempt to read EXIF metadata of images using only native commands.
Note that it doesn't work on all images yet.
September 29, 2012 HideInput.exe is a new batch utility, written in C#.
It reads one line of keyboard input while hiding what's being typed, by temporarily setting the console foreground color equal to its background color.
To keep on the safe side, use its optional /C switch to immediately clear the screen afterwards, otherwise the typed input still remains in the screen buffer:

FOR /F "tokens=*" %%A IN ('HIDEINPUT.EXE /C') DO SET password=%%A

Note: Even when used with SETLOCAL, this is not a safe way to prompt for and use passwords in batch files (it is never safe to use passwords in batch files), but it beats SET /P.
September 27, 2012 • David Keller optimized the code for VBSAssoc.bat, a batch file to associate the .vbs extension with CSCRIPT.EXE.
The old version still used a workaround required in NT 4, it has now been replaced with much "leaner" code.

Thanks David
September 25, 2012 FastPing.exe, written in C#, is a fast(er) alternative to PING.
It only returns the responding IP address and an "ErrorLevel" 0 on success or 1 on failure to connect.
September 24, 2012 RunBackupWithoutSleep.bat has been updated: it now uses a text file created when run for the first time to remember the original power scheme.
The previous version of the batch file would retrieve the active power scheme when started, using the POWERCFG /List command, but this will return the incorrect scheme if another instance of the batchfile is running simultaneously.
September 17, 2012 RPCPING has some ASCII null characters in its output, causing havoc in the HTML generated by AllHelp.vbs version 2.10.
VBScript is notorious for stumbling over ASCII null characters, and I did not succeed in removing them all with VBScript only.
The workaround was fairly simple: pipe RPCPING's output through MORE and all null characters are gone.
So AllHelp.vbs has been updated once more, to version 2.12.
I also optimized some of its code, it has become slightly faster and less of a resource hog.
September 16, 2012 • Another update for AllHelp.vbs:
  • help for lots of additional commands has been added, see help for Windows 7
  • if no short summary is available for a Windows command, its file description will be used instead
On my own computers, the file size of the generated HTML is over 400 KB, and running the script takes a lot of computer resources.
Note that some commands found on your computer may not be available on other computers.
September 14, 2012 • A major update for AllHelp.vbs:
  • help for lots of additional commands (Resource Kits etc.) has been added
  • improved command index
  • improved web page layout
  • improved error handling in case commands are not available
September 13, 2012 • A minor update for AllHelp.vbs:
  • help for lots of commands has been added
  • special characters in the help text are now escaped
  • a bug has been fixed where commands not listed in HELP were added only for English Windows versions
September 7, 2012 • I wrote RunBackupWithoutSleep.bat because I got really fed up with long backup jobs being aborted in Windows 7 by the computer going into sleep mode.
This batch file can be used to change the power scheme to "High performance" (always on), run the specified (backup/defrag/any other long job) command without interference by sleep or hibernation modes, and then restore the original power scheme again.
Note that for non-English systems, the "High performance" scheme may be known under a different name, and you may have to modify the batch file accordingly.

Warning: this batch file may not work for all GUI based (backup) programs, but it should work fine for scripts and command line programs.
September 3, 2012 AllHelp.vbs has been updated again:
  • double line spacing due to Cr/Cr/Lf instead of Cr/Lf in some commands' output has been fixed
  • commands not supported by HELP (e.g. CHOICE and WMIC, depending on the Windows version) were added
  • if a command is listed in HELP's output, but no help is available (e.g. BCDEDIT, or OPENFILES in 64-bit Windows), it no longer gets a link to an empty help text
  • the script now also distinguishes between 32 and 64 bits Windows versions
Navid sent me an updated HTML generated by the new script for Windows 8 Evaluation.

Thanks again Navid
August 27, 2012 AllHelp.vbs has been updated:
  • I made sure the help texts are in ASCII, and I added a descriptive title to each "flashing" window that AllHelp uses to retrieve the commands' help text
  • when calling HELP SC, SC will wait for keyboard input; I tried to make the script send keyboard input, but SC does not seem to accept Standard Input; the workaround I came up with is a message in the window title, asking to press Enter to continue
Note that in order for DISKPART's output to be captured, you have to run this script with elevated privileges.
August 26, 2012 • Navid Roux sent me a note that CHOICE's /M switch was missing.
It turned out he was using Windows 8, so I asked him to send me the results of my AllHelp.vbs to generate a page with "all" help for Windows 8.
The result is available here, so you can get a glimpse of the changes that may be required in your batch files if you are going to upgrade to Windows 8.

Thanks Navid
August 19, 2012 • UpdateVBSEdit.vbs is a new script that checks if a new version of VBSEdit is available, and if so, offers to download it.
August 16, 2012 RxGrep.exe has been updated: the example in the help text has been corrected and an optional /I command line switch for case insensitive searches has been added.
August 12, 2012 RxGrep.exe is a new multi-line FINDSTR/GREP like tool.
Contrary to FINDSTR its search pattern can span multiple lines.
I wrote it to show me only the relevant lines of ROBOCOPY's output, filtering out all directories where no action took place:

ROBOCOPY D:\sourcedir E:\targetdir /NP /MIR | RXGREP "\s+\d+\s+D:\\sourcedir\\[^\n\r]*\r\n([^\n\r\\]+\r\n)+"

will return something like:
                         125    D:\sourcedir\subdir\
            New File                 342        brandnewfile.ext
            Newer                  4.06m        updatedfile.ext
          *EXTRA File              2.40m        deletedfile.ext
Hover your mouse over the regular expression or the output to highlight the "components" of the regular expression and their matches.
August 8, 2012 FoxitVer.vbs, Revo_ver.vbs and Revo_ver.kix have been updated: these scripts rely on software manufacturer's web pages, and web pages tend to change often.
August 7, 2012 DiskTypes.vbs has been updated: it now differentiates between USB 2.0/1.1 and USB 3.0 ports, and its code has been optimized.
August 4, 2012 • I added a note to my FAQ on using WMIC to create directories with the current date or time in their names.
July 23, 2012 LoCase.exe and UpCase.exe have been updated: they now feature an optional /Verbose switch to display the number of files renamed on screen.
Regardless of this switch being used or not, the number of files renamed is still returned as "ErrorLevel".
July 21, 2012 LoCase.exe and UpCase.exe are the C# versions of the batch files of the same name.
LoCase.exe renames all specified files to all lower case, UpCase.exe renames them (surprise!) to all upper case.
July 20, 2012 PrintAny.exe had a major update: it now tries to use the registered Print or PrintTo verb first, and if that fails, it will try and find the print command in the registry.
In short: it now also supports DDE printing (e.g. Word and Excel documents — if Microsoft Office is installed).

• Two corrections and an update:
Chad Wilson found and corrected an error in my FTP upload code sample.
Jerry Wines found and corrected an error in Brian Williams' Add.bat
And Marcel Niënkemper sent me an updated connection string for my Read Excel files page, to allow reading Office 2007 files too.

Thanks guys
July 19, 2012 CloneDate.exe is the C# version of CloneDate.vbs.
Both will modify the timestamp of the specified target file(s) to match the specified source file's timestamp.
The executable's optional /Debug switch will display the number of matching target files, the matching file names and their timestamps before and after modification.
July 18, 2012 PrintAny.exe is the C# version of PrintAny.bat.
Both will read the print command for the specified file type from the registry, and use that command to print the specified file.
Besides registered Print commands, the executable can also use PrintTo commands if registered.
DDE printing is not supported by PrintAny.exe (nor by PrintAny.bat for that matter)!
The executable's optional /List switch will display the print or printto command without executing it, the optional /Debug switch will list intermediate results from the registry as well.
July 11, 2012 • A minor update for Tee.exe: it now reads Standard Input (and writes to Standard Output) character by character, instead of line by line.
July 6, 2012 • Wireless.exe is a new GUI based (sorry about that 😉) utility, written in C#, to monitor wireless 802.11 connections.
In case of poor signal strength, it can be used to find a better location or direction in order to improve signal strength.
July 2, 2012 • Using unique file names for temporary files can be a challenge in batch files.
Many of my batch files, when requiring a temporary file, use a combination of the batch file name and the startup time to allow running multiple instances of the batch file without interfering with each other's temporary files. This still requires some time (seconds) between the start of the instances.

NewTempFile.exe, written in C#, solves this problem by using .NET's System.IO.Path.GetTempFileName( ) method to create a unique temporary file and return its name on screen.
To use it in a batch file, use the following code:

FOR /F "tokens=*" %%A IN ('NEWTEMPFILE.EXE') DO SET TempFile="%%~A"

This creates a temporary file, whose name is stored in the environment variable TempFile (creating the file instantly, and then returning its name, minimizes the chances of duplicate file names if multiple instances run simultaneously).
You can then redirect text and output to %TempFile%.

• A bug in RC.bat has been fixed: the previous version would sometimes fail due to leading zeroes in time difference calculations.


Archived News pages
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: 2022-10-22