Rob van der Woude's Scripting Pages

News Archives 2008 Q2


[ Back to the current news page... ]


June 29, 2008 FlushBin.bat (for Windows XP) uses Windows' Disk Cleanup Tool (CLEANMGR.EXE) to completely automate flushing temporary files, IE's cache, leftover ChkDsk files and the Recycle Bin. Unlike similar batch files found elsewhere, this one does not require any user interaction to create a cleanup job, but instead writes one directly to the registry.
Read more on adding modules to cleanmgr.exe, which should also help explain how this batch file creates its temporary cleanup jobs.
Read the comments in the batch file to learn how to modify the list of selected actions for this batch file.
June 27, 2008 • My wife often complains about strange error messages she can't remember. So I decided to write her a screen capture script that will store a screen dump without any interaction: Capture.bat. Whenever she gets an error message, she can now save it and show me the exact message to investigate.
The actual work is done by IrfanView, the batch file only functions as a wrapper.
To use it, create a shortcut to the batch file in the Quick Launch Tray, and make sure it runs minimized. Now each time you click the shortcut in the Quick Launch Tray, a screen dump will be appended to a multi-page TIF file named "capture.tif". Unless an alternative directory is specified on the command line, this TIF file will be located in C:\
June 26, 2008 • In the category "Learning By Mistake(s)", I wrote CkBkSchd.bat, a batch file that lists the status of all Scheduled Tasks that have the word "backup" in their names.
Never assume that your scheduled backups perform flawlessly just because they don't popup error messages... ☹️

• I added a new Internet section to my Batch File Scripting Techniques page.

• I also added a new (subsection and) page to my VBScript Scripting Techniques section: How to force a script to run in CSCRIPT.
June 21, 2008 • It's summer, and today I uploaded a new page on controlling DDE servers from the command line, i.e. controlling programs that often don't support command line control. Think making Word or Excel print a file...
June 19, 2008 • A milestone for this site: early this morning the 2,000,000th visitor since July 2007 was counted.

• I updated GetPrint.vbs, my latest script that will list the print commands for all registered file types:
  • It now also displays a file extension for the registered file type (but only 1 extension per file type: the last one listed in the registry for that file type).
  • DDE based print commands are no longer listed, only command lines.
  • The on-screen help now explains how to use ASSOC and FINDSTR to find print commands for a specific file extension.
  • The results are now displayed as soon as they are found, instead of after the registry scan has been completed.
    This also implies that each print command will be displayed in a separate dialog window if the script is run in WSCRIPT, so in that case you would have to click hundreds of "ok" buttons!
  • Did I mention you'd better not run this script in WSCRIPT? 😉

• If you ever need to write WMI queries in PowerShell, give Ed Wilson's PowerShell Scriptomatic a try.
Find more PowerShell Tools here.

• Today I discovered ClassExec, a command line utility to execute any command (including DDE commands) associated with a file type or extension.
Use it to open, print, view or edit files, whatever is registered for that file type in HKEY_CLASSES_ROOT.

On my computer, I have 3 programs available to open .DOC files: Word Viewer, WordPerfect and OpenOffice Writer.
classexec worddocument.doc --action print will generate an error message, because my default program to open .DOC files is the Word Viewer, which doesn't have a registered print command.
classexec worddocument.doc --action print --class .wpd converts/opens worddocument.doc in WordPerfect (the program associated with .WPD files), prints the document to the default printer, and keeps WordPerfect opened.
classexec worddocument.doc --action print --class .wpd --ifexec does the same, but closes WordPerfect when the printing is finished.
classexec worddocument.doc --action print --class .odt --ifexec silently opens worddocument.doc in OpenOffice Writer (the program associated with .ODT files), prints the file and closes again.

I found ClassExec while searching for another utility: CMCDDE.EXE, a command line tool to send DDE commands to any DDE server. It used to be available at but not anymore...
June 18, 2008 • I was searching the registry for a print command, when it dawned on me that a quick adaptation of my GetRunDl.vbs script could do this for me.
That's how GetPrint.vbs was born.
Run it in CSCRIPT.EXE (*) without command line arguments to list the Print and PrintTo commands for all file associations in the registry.

(*) Do not use WSCRIPT.EXE! Believe me, you don't want a list of these proportions in a single dialog box.
June 16, 2008 • Oops!
Today I discovered and corrected some serious "copy/paste errors" in the HTML code for images in my SecEdit page; these errors rendered the images completely invisible in Internet Explorer 6 (and maybe in earlier versions too). The images should now be visible again in all browsers. Please notify me if they aren't...
June 14, 2008 PrnPDF8.bat is a batch file that uses Foxit Reader or Adobe Reader 8 to print a PDF file unattended. Unlike my earlier PrintPDF.bat, PrnPDF8.bat doesn't check the registry for the latest Adobe Reader version, it just assumes that either Foxit Reader or Adobe Reader 8 is installed. This means it should also work on computers with Acrobat/Adobe Writer installed!

• Several new sections have been added to my Command Line Switches page.
June 11, 2008 PrintPPT.bat is a simple batch file that uses PowerPoint or the PowerPoint Viewer to open a print dialog for a PowerPoint file.
It is a spin-off of some tests I performed for my Command Line Switches page.
June 9, 2008 • Neither MS Word, nor the Word Viewer accept print commands from the command line. So that's where PrintDoc.vbs comes to the rescue.
Based on a script by Arnout van der Vorst, PrintDoc.vbs prints a specified Word document on the default printer.
June 8, 2008 IrfanView, Internet Explorer, Notepad and Wordpad sections have been added to the command line switches page.
I also added a section Related Stuff, with links to lists of command line switches that I haven't been able to verify yet (I don't have MS-Office, so it's hard to test the command line switches for MS-Office programs).
June 7, 2008 • Today I started writing down the first part of my collection of command line switches for programs that usually aren't known for their command line orientation.
This will enable you to create "quick-and-dirty" but reliable batch files to print or convert files more easily, without the need to dig into details about COM objects.
I started with Adobe Reader, Foxit Reader, Nero Burning ROM, OpenOffice, WordPerfect and XPS Viewer, more programs will follow soon.

In the menu, the new page can be found under "batch files", "command line switches".
June 6, 2008 • As promised, the first new addition to the Batch File Scripting Techniques section: Verify if Variables are Defined, with a few paragraphs about "hidden" environment variables.
June 5, 2008 • The "new" Batch File Scripting Techniques section is actually a reorganized version of the old Batch How To page.
No new pages have been added yet, but more will follow soon.
June 4, 2008 • I wrote FileDiff.vbs to check if two files differ in size, last modified date ("timestamp") or version.
Its usage may seem a little complex, so I'll try to explain it using some examples (but you'd better read the script's on-screen help first).
In the following example, let's assume that bigfile.doc is much larger than tinyfile.txt:

CSCRIPT.EXE FileDiff.vbs bigfile.doc tinyfile.txt /S /G

In this case, the return code will be 0 ("true"), because we are comparing file sizes (/S) and we want to know if the first file is greater (/G) than the second one.
In the following example, let's assume that oldfile.doc is much older than newfile.doc:

CSCRIPT.EXE FileDiff.vbs oldfile.doc newfile.doc /T /E

In this case, the return code will be 1 ("false"), because we are comparing timestamps (/T) and we want to know if these timestamps are equal (/E).

CSCRIPT.EXE FileDiff.vbs %windir%\system32\bootcfg.exe %windir%\system32\bootok.exe /V /E

In this case, the return code will probably be 0 ("true"), because we are comparing file versions (/V) and we want to know if these version are equal (/E). Since both are native Windows executables, they will usually have identical version numbers (they have on my computer).
June 2, 2008 CloneDate.vbs has been updated.
If the target file specification includes the source file (e.g. CloneDate.vbs filename.ext filename.*), the source file's timestamp will not be "modified".
June 1, 2008 CloneDate.vbs is a script to read the timestamp (LastModified date and time) of a file (the source) and then set the timestamp of one or more (target) files to that same date and time.
This script is based on an article by the Scripting Guys in the June 2008 issue of the Dutch TechNet Magazine.
May 31, 2008 • The Hardware Requirements page now also contains a section on checking screen resolutions.
May 30, 2008 ListSDKs.bat will list all Microsoft SDKs (short name, version number and description) installed on the local computer, or, if an SDK short name is specified on the command line, the version number will be returned.
May 26, 2008 • After having created a Software Requirements page, almost two weeks ago, the new Hardware Requirements page was to be expected...
May 17, 2008 • As a spin-off of my Check Software Requirements page, I wrote 2 scripts to list all Office Viewers installed on the local computer: LstOffVw.bat which uses file version checks, and LstOffVw.vbs which uses WMI.
On my computer the VBScript/WMI version takes 78 seconds to complete, the batch file needed only 8 seconds.

Adersoft has just released HtaEdit, an HTA editor/IDE similar to their great VbsEdit VBScript editor/IDE (which has also been updated).

• I added another script to check the version of installed software:
WSHVer.vbs checks the Windows Script Host version, and returns an "errorlevel" 1 if it is older than a specified minimum.
May 15, 2008 • The Check Software Requirements page has been updated, and a KiXtart version of the MDACVer script was added.
May 14, 2008 • This site's 1000th "indexable page" (according to FreeFind's site index report): Check Software Requirements.
More techniques and samples on how to verify if software versions meet a required minimum.
May 8, 2008 • I wrote another scripts to check the version of installed software:
WinInVer.vbs checks the Windows Installer version, and returns an "errorlevel" 1 if it is older than a specified minimum.
May 7, 2008 • I wrote some scripts to check the versions of installed software:
MDACVer.vbs checks the MDAC version, and returns an "errorlevel" 1 if it is older than a specified minimum;
NETFxVer.bat lists all .NET Framework versions found on the local computer.
April 7, 2008 • It seems Microsoft has removed the WSH 5.6 for Windows 9x/ME and NT 4 download from their site. Or does anyone out there know where it has been moved to?
April 5, 2008 • On my Unattended Installation Procedures for Specific Software page I added a section on silent installations for OpenOffice.
April 4, 2008 • In my new SeCEdit page I explain how to use SeCEdit and MMC to set the security on files, folders and even on registry keys with batch commands.
I recently learned this technique from Adriaan Westra, who has used it successfully on Windows 2000, XP and Server 2003.

Thanks again, Adriaan.


Archived News pages
Archived news from 2008
Archived news from 2007


page last modified: 2022-11-04