|March 22, 2009||• I added the core functionality of yesterday's GConv.vbs to the VBScript Scripting Techniques section.|
|March 21, 2009||• Google Calculator can be used for unit conversions (e.g. metres to yards etc.). Internet Explorer can be automated to retrieve web pages. So why not combine these features? Behold GConv.vbs, a script that allows us to perform unit conversions on the command line.|
|March 19, 2009||• A new command has been added to my Short command line tips page:
This command converts "isolated" linefeeds in (Unix) text files to carriage return/linefeed pairs.
• Carlos M. did some research on the hitherto undocumented or poorly documented file attributes substitution of the
|March 13, 2009||• As a spin-off of a project I added a page containing a number of conversion routines (i.e. convert temperatures from °F to °C, distances from nautical miles to kilometers, etc.).
But make sure to double check before using the results to plan your next Antarctic expedition, especially considering the date this page was made...
|March 2, 2009||• Leo Gutierrez Ramirez found a way to add any (language) style comments to
You may use any or no comment characters, as everything after the closing doublequote seems to be ignored.
|February 23, 2009||• Nushu sent me a message with a trick to combine a batch file and other scripting languages in a single file without the need to create temporary files.
His example uses AutoIt, but it can also be used for KiXtart scripts and .REG files!
• Carlos M. found a way to increase the number of variables available in a
This may be useful to handle longer lists in a single
|February 22, 2009||• Justin discovered an undocumented feature of the
Compare that to:
which will rename
• Because of Justin's information on the
|February 20, 2009||• I am rewriting my old DATE/TIME in NT page.
The new pages are listed in the batch techniques page, Time & Date section:
• I also added a page listing techniques to add or remove leading zeroes in NT batch.
|February 18, 2009||• Denis St-Pierre wrote to me about hours of debugging caused by VBScript's default
Denis wrote a test script to familiarize yourself with the concept and with VBScript's behaviour. This may be particularly important for those who learned scripting with a different language, since many if not most languages have a different default behaviour.
I also added Denis' findings to my VBScript debugging page.
|February 17, 2009||• I promised you a What's New replacement, here it is: What's New!
You can select the time span, and the files are listed by their last modified date, in reverse order.
• Google likes to receive a sitemap to crawl a site more accurately. So recently I started writing a sitemap generator script in VBScript, but after a while decided it was a lot easier in batch, and wrote Sitemap.bat. It does have one serious limitation: it cannot handle "high ASCII" nor Unicode characters in file names.
|February 16, 2009||• Unfortunately FreeFind's What's New service doesn't support PHP based sites.
That's why I terminated my FreeFind account.
You'll have to make do with this News page for a while.
I'm working on my own "What's New" replacement.
Sorry for the inconvenience.
|February 14, 2009||• Jiri Hofreiter from Prague (Czech Republic) found a better, simpler solution to the third batch challenge.
I suppose that makes him a batch guru, and puts me out of work
• While on the subject of batch gurus, Ildar Shaimordanov from Russia sent me an ingenious way to add leading zeroes to dates and times.
He described it in one of his articles, but I'm glad he also sent me an e-mail in English
What it boils down to is that you can replace the leading space by a zero:
Note the spaces following the colons; they are essential!
So if you have a US system with M/D/YYYY date format, today's %DATE% value would probably be
I'm not sure about a week ago, though, as I don't have a US system myself. You will have to decide for yourself if this trick can be used on your system(s).
Another great trick by Ildar is the way he ignores a leading day of the week when parsing the date to get it in YYYYMMDD format.
Where I use:
to strip off the leading weekday and then start parsing the date:
(code valid for MM/DD/YYYY format, adjust the order of %%A and %%B if necessary), and I still have to account for missing leading zeroes, Ildar just starts parsing from the end of the string backwards. Since he already replaced all spaces by zeroes, this will do the trick perfectly:
(code for DD*MM*YYYY format). It is also completely independent of the delimiter used.
|February 12, 2009||• A new page has been added to the VBScript Scripting Techniques section: Convert ASCII to UTF-8.
It contains a sample function using ADODB.Stream to convert a "plain" ASCII file to UTF-8 encoding. It does not correctly convert from "standard" Unicode to UTF-8.
The code is based on a forum post by JTMar.
|February 9, 2009||• I added a new page to the VBScript Scripting Techniques section: Environment Variables.
Most VBScript users will be familiar with the WSH Shell's
At least now you know where to look for more information.
The WMI sample code on this page was derived from a sample by Robbie Allen, author of the Windows Server Cookbook.
• The reason I had been looking at setting environment variables was my new SetDate.vbs, a script that, when scheduled daily at midnight and at system startup, sets a couple of environment variables with the current day, month, year, week, quarter, weekday and day of the year. These variables can then be used by batch files to name log files, backup directories, etc.
These environment variables are (for today, Tuesday, October 24, 2017):
Note that (the copies of) the environment variables keep their value within a session, once started, even if the date changes during that session. So the date variables available in a batch file/session are those of the date at the moment the batch file/session started!
• To all webmasters who have deeplinked to my site: please update the urls (".html" becomes ".php")!
For the next couple of weeks redirection pages will automatically lead visitors to the new pages, but I intend to remove these redirection pages by the end of this month.
|February 8, 2009||• Now that the "no change period" is over, a new chapter in the VBScript Scripting Techniques section was added: Windows Installer.
It contains two sample scripts by Adriaan Westra.
|February 7, 2009||• Finally, I managed to get 2 old pages up-to-date (at least as far as these pages' technique is concerned, not their content): the Batch HowTos page and the FOR loops interactive demo.
I think the FOR loops interactive demo especially may still be of interest for everyone who wants to expand her or his understanding of FOR loops.
|February 6, 2009||• Done!
All HTML pages have been replaced by PHP.
I'll be testing all pages once more, if you encounter any problem loading a page, please send a message to my e-mail address.
• Those of you who subscribed with ChangeDetection to monitor my pages, you may receive a notification for each page you subscribed for, and that will be the last ones. You will need to resubscribe to the new pages, that now have a
• A note on Web2PDF, the "Save page as PDF" button below the menu: examining its output I found that it does not use all my CSS code for printing. If you use "Print" from the menu to print a page to a local PDF printer, you'll notice the left page margin is not as wide as on screen, and all background colors are ignored, and all "outward" links are followed by their URLs. Web2PDF also uses the narrower left margin, but it does print background colors and does not print the URLs for outward links. So now you have a choice.
|February 5, 2009||• I'm almost done converting all pages of this site from HTML to PHP.
You can have a sneak preview if you like. Note that links to sources won't work in this sneak preview.
Right now you won't find any spectacular changes or novelties, my first priority is to get everything going and end the "no-change period".
One novelty: you can now save any page as PDF, thanks to Web2PDF.
Another, less obvious change is the improved page load time. To state it more accurately: the page starts displaying while it is still being loaded because a greater part of the "non-content code" has been moved to the end of the pages.
|February 1, 2009||• The next couple of days I will be converting all pages of this site from HTML to PHP.
You may not notice it at all, unless you subscribed to ChangeDetection to monitor one or more of these pages; in that case you'll get at least one e-mail notification for every page you monitor.
Sorry for the inconvenience, but I trust it will prove worthwhile.
|January 29, 2009||• Today I updated WANIP.bat and WANIP.vbs, two scripts to display your computer's WAN IP address.
They both use this PHP one-liner:
|January 24, 2009||• For the foreseeable future this will be my final DEBUG based "clock spin-off": IsRTCSet.bat.
It too reads the CMOS, this time to determine if the Real Time Clock was set. If true, it will return an errorlevel 0, if false an errorlevel 1.
|January 22, 2009||• Just for fun I wrote FlopDOS.bat, a "true" MS-DOS batch file that retrieves the floppy drive configuration from the CMOS (using DEBUG).
Do not use it in CMD.EXE (Windows NT 4 or later), or if you want to test it use
For NT 4 and later the preferred method is using Floppy.bat.
|January 20, 2009||• One of the most frequently asked questions (by visitors of this site) is how to create files or directories with the current date and/or time in their names.
As explained in the date/time section of this site there are many ways to get the current date in a variable that can be used in file and directory names.
The biggest disadvantage of using batch techniques to read date and time is the dependency of regional or international settings of the local computer: delimiter, order, day of week or no day of week, they all depend on these local settings. As demonstrated by my SortDate.bat and SortTime.bat, it requires lots of code to convert date and time to a fixed format.
I figured there must be an easier way. After all, "true" scripting languages like KiXtart and VBScript use (several) fixed date and time formats.
Then suddenly it dawned on me that the CMOS (BIOS) settings also use fixed date and time formats. And I used DEBUG before to read from the BIOS, so I gave it a try.
With help from The Starman's DEBUG Tutorial and PLASMA Online's CMOS Register Reference I found I could use the following DEBUG commands:
09 (if greater than 7F, clock was not set after loss of battery power)
03 (day of the week)
I used this technique in 3 new batch files:
• Using the same DEBUG technique described before, Floppy.bat reads the floppy drives configuration from the CMOS. This information is next to impossible to read using WMI.
|January 12, 2009||• Some time ago, I noticed that several old batch files, using REG.EXE (version 2), no longer worked with version 3.0, which is native in XP.
When Tony Cardalda wrote to me that iDate.bat didn't work, I decided it was about time to set this right.
One could, of course, check the version of REG.EXE and then decide on the batch code to be used.
Unfortunately, Vista's version of REG.EXE doesn't seem to display its version number at all.
However, every version of REG.EXE so far seems to write its error messages to Standard Error, which means that
This made me decide to use a Q&D workaround: call both the old style and new style REG commands, and let
In Windows XP and Vista, the first
In Windows NT 4 with Resource Kit and Windows 2000 the first
In either case, the end result is that environment variable
|January 10, 2009||• FfxCAC.bat will clear all Firefox cache directories in all local profiles.
In Windows XP it will abort if Firefox is still active in memory, in older Windows versions it will just fail to completely flush the current user's cache if Firefox is still active.
|January 9, 2009||• I updated my page on login scripts: I added paragraphs on using login scripts to modify user settings, and some best practices.|
|January 8, 2009||• My new XL2CSV.vbs uses Excel automation to convert an Excel sheet to CSV.
• A new command was added to my NT admin one-liners page:
It can be used to check who is logged in on remotecomputer.
|January 4, 2009||• I'm working on a page on login scripts.
Though I intend to add much more information, I think it is ready for a "sneak preview" by now.
The page contains code snippets in NT batch, KiXtart and VBScript, but buttons are available to hide snippets for a specific language.
In case you want to deeplink for a specific language:
The buttons' functionality can be "automated" by adding parameters to the URL, e.g.
The parameters aren't case sensitive and can be combined in any order, and you may use
|January 1, 2009||• I wish you all a happy 2009.
|Archived news from 2008 Q4|
|Archived news from 2008 Q3|
|Archived news from 2008 Q2|
|Archived news from 2008 Q1|
|Archived news from 2007 Q4|
|Archived news from 2007 Q3|
|Archived news from 2007 Q2|
|Archived news from 2007 Q1|
|page last uploaded: 2017-07-06, 12:37|