pages are an HTML-version of the 1cmdfaq.
txt faq-file contained in my
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.
: These pages contain my
assorted cmd.exe script tricks for Windows NT/2000/XP/7 and 10 . The
items are in no particular order. There is some overlap in some of
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
: However, you are free to quote
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
Simply put, no personal support. 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/Windows7/8/... cmd script
questions, related or unrelated, rather post them to the alt.msdos.batch.nt
Usenet newsgroup. (Don't forget to define your OS.).
Contributions on the net are
acknowledged further down
on this page.
Note, however, that submissions of outside items to this collection
are not invited. This basically is my own collection, not an open
: The scripts in this FAQ have
originally been tested on a Windows XP [Version 5.1.2600]
Professional Edition, SP2, system (SP3 since September 2008). A
number but not all of the scripts have also been tested on 64-bit
Windows 7 since 2014 and Windows 10 since 2017. 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
: 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.
An important note to Garbo repository users
The workstation hosting the
the University of Vaasa,
has broken down during 2012. The university's
has informed me that it will not be replaced. Thus all the
potentially remaining direct references to the utilities at Garbo in
this FAQ are out of date.
continues to be available, now at a private ISP address. You may
freely download it for your own, private purposes. But contrary to
some past Garbo exceptional arrangements, I do not give permissions to
mirroring, that is carrying my materials for downloading at other
locations. (I am retired, fully served, since September 2011. I now
say routinely no to all requests.
: 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
(Note, I mostly use the older GAWK and SED versions in the FAQ):
SED.EXE Stream Editor
20368 Oct 1 1991 sed15x.zip
HHSED executable, E.Raymond+D.Kirschbaum+H.Helman
15495 Oct 28 1998 sed15exe.zip
MS-DOS HHsed, compliant with Windows 32-bit, H.Helman
GnuWin32 Sed for Windows
44661 Feb 11 2005 ssed362.zip
Super-sed enhanced stream editor, Paolo Bonzini
A Pattern Scanning and Processing Language
233923 Mar 25 1995 gawk2156.zip
GNU awk text scanning and processing language
878915 Oct 25 2003 UnxUpdates.zip
(see, however, an availability note
Updates for UnxUtils GNU utilities for native Win32
GnuWin32 Gawk for Windows
(Rename to unx
gawk.exe and unx
for this FAQ, when indicated.)
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.
can be used to solve some, if not most of the
scripting problems. The same goes for
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.
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
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 (and a
number of knowledgeable non-listed posters using aliases) have either
directly contributed to or otherwise knowingly or unknowingly
influenced the contents of this FAQ in a positive manner:
Said, Marco Maier
Smith, Gary L.