These pages are a HTML-version of the 1cmdfaq.
txt faq-file contained in my
tscmd.zip
command line interface (CLI) collection. That zipped file has
a considerable number of additional .cmd script files. It is
recommended that you also get the zipped version as a companion.
The major difference of this html version is that this page was
started during the Thu 6-Mar-2008 version 46a with years of
hindsight of building up the FAQ items since Fri 28-Nov-2003. A few
of the items are therefore slightly differently written, in particular
utilizing the illustrative possibilities of the HTML-code.
Description: These pages contain my
assorted cmd.exe script tricks for Windows NT/2000/XP/.. . The
items are in no particular order. There is some overlap in some of
the items.
Web pages or any other reproduction:
These pages are copyrighted. No part of this material, nor its index,
nor the entire contents may be reproduced (in any language) on any
other World Wide Web pages or in any other electronic, physical or
similar manner.
Quoting: However, you are free to quote
brief passages from this page or to post links to
the items in your messages and Usenet news postings
provided you clearly indicate the source.
Asking for programming advice:
Requests for programming advice should not be emailed to the author. Such
requests are rejected. I can't afford the time and effort of giving
free emailed consultation. If you have NT/2000/XP/Vista/.. .cmd script
questions, related or unrelated, rather post them to the
alt.msdos.batch.nt
Usenet newsgroup. (Don't forget to define your OS.)
Submitting: Contributions on the net are
acknowledged at the end of this page. Note, however, that submissions
of outside items to this collection are not invited. This basically is
my own collection, not an open repository.
Caveats: The scripts in this FAQ have
been tested on a Windows XP [Version 5.1.2600] Professional Edition,
SP2, system (SP3 since September 2008). There is no guarantee that all
the solutions are fully backwards, or forwards, compatible. Where
relevant, the date/time format assumed is "31.01.2005 14:12:18". In
other words, the order is dd.mm.yyyy, the date separator is ".", the
timefields separator is ":" and, in particular, the 24-hour format is
assumed. For more on caveats see 1cmdfaq.txt
Disclaimer: The author shall not be
liable to the user for any direct, indirect or consequential loss
arising from the use of, or inability to use, any information,
program, script or file howsoever caused. No warranty is given that
the scripts, the programs or the advice given will work under all
circumstances. You use everything at your own risk.
Additional utilities: Two very common
external auxiliary programs are used in a few of the solution versions
presented. It is highly recommended anyway that you obtain the
following utilities:
SED.EXE Stream Editor
20368 Oct 1 1991
sed15x.zip
HHSED executable, E.Raymond+D.Kirschbaum+H.Helman
(Note, I mostly use the older GAWK and SED versions in the FAQ)
GnuWin32 Sed for Windows
UnxUtils
at
SourceForge.net
GAWK.EXE A Pattern Scanning and Processing Language
233923 Mar 25 1995
gawk2156.zip
GNU awk text scanning and processing language
or
878915 Oct 25 2003
UnxUpdates.zip
(see, however,
an availability note)
Updates for UnxUtils GNU utilities for native Win32
GnuWin32 Gawk for Windows
UnxUtils
at
SourceForge.net
(Rename to
unxgawk.exe and
unxsed.exe for this FAQ.)
Be forewarned. If you use a different GAWK (or SED) versions the syntax requirements
may slightly differ. See the example in
item #6.
A few words about the philosophy of using gawk and sed solutions:
Google Groups Aug 29 2002, 8:43 am
Google Groups Apr 16 2005, 5:00 pm
However, some of these tricks might arise in a multi-user
setting where it is best to assume that only the native commands are
available. Therefore, the usage of any extra tools is avoided as the
only option as much as reasonable.
Visual
Basic Script can be used to solve some, if not most of the
scripting problems. The same goes for QBASIC. However, not all the
items which could have been solved with Basic aided command line
scripts include the option. This is above all CMD.EXE scripting FAQ,
not a VBS or QBASIC FAQ.
Furthermore, there are a number of
utilities of
my own and further scripts included in the tscmd.zip package.
Calendar issues:
A number of date-related items and routines are involved.
Date-related standards and calculations can be quite involved.
Therefore, not all the refinements are fulfilled in the strictest
sense. To give one example, one item is about the date a certain
number of days ago. The effect of a potential daylight saving time
("summertime") shift is ignored. Thus the result might be off by one
day near the midnight under special circumstances. Likewise,
timezone differences are ignored. A reader requiring more accurate
knowledge is referred to the web pages by Dr. John Stockton which
can be found by starting at
http://www.merlyn.demon.co.uk/index.htm#dat
Contributors:
A FAQ-like collection always is more or less a product
of collective knowledge. The initial origins of many of the ideas
are often ambiguous and may have been discovered separately by
several authors. Thus a collective thanks for the NT/2000/XP/..
scripting community is in order. Furthermore, at least the following
individuals have either directly contributed to or otherwise
knowingly or unknowingly influenced the contents of this FAQ in a
positive manner:
Allen, William
Ballenger, Si
Briscoe, Walter
Calvert, Clay
Davis, Ted
Dunbar, Al
Dye, Charles
Grove, Harlan
Hardy, Steve
Kasal, Stepan
Kleebauer, Herbert
Lavedas, Tom
Lawrence, Ritchie
Meinhard, Klaus
Prins, Robert
Robyn, Phil
Said, Marco Maier
Smith, Gary L.
Smith, Paul
Stockton, John
Stewart, Bill
Suhovey, Alexander
Tacke, Matthias
Takashi, Ootani
Vargo, Todd