These pages are an 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/7 and 10 . 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:
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.).
Submitting: 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
repository.
Caveats: 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. Testing with Windows
11 is pending. 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.
An important note to Garbo repository users:
The workstation hosting the
Garbo
repository at
the
University of Vaasa,
Finland has broken down during 2012. The university's
Computer Centre
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.
However,
tscmd.zip
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.)
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:
(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
For 32-bit
15495 Oct 28 1998
sed15exe.zip
MS-DOS HHsed, compliant with Windows 32-bit, H.Helman
or
GnuWin32 Sed for Windows
UnxUtils
[
2]
at
SourceForge.net
or
44661 Feb 11 2005
ssed362.zip
Super-sed enhanced stream editor, Paolo Bonzini
GAWK.EXE
A Pattern Scanning and Processing Language
233923 Mar 25 1995
gawk2156.zip
GNU awk text scanning and processing language
For 32-bit
878915 Oct 25 2003
UnxUpdates.zip
(see, however,
an availability note
[
M]
[
T])
Updates for UnxUtils GNU utilities for native Win32
GnuWin32 Gawk for Windows
UnxUtils
[
2]
at
SourceForge.net
(Rename to
unxgawk.exe and
unxsed.exe
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
[
M]
Google Groups Apr 16 2005, 5:00 pm
[
M]
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
[2]
[3]
[4]
can be used to solve some, if not most of the
scripting problems. The same goes for
QBASIC
[
2].
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 seek the web pages for old UseNet news
postings by Dr. John Stockton.
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 (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:
Allen, William
Ballenger, Si
Beckermann, Carsten
Briscoe, Walter
Brown, Ralph
Calvert, Clay
Davis, Ted
Dunbar, Al
Dye, Charles
Grove, Harlan
Hardy, Steve
Kasal, Stepan
Kleebauer, Herbert
Lavedas, Tom
Lawrence, Ritchie
Meinhard, Klaus
Mäenpää, Pentti
O'Regan, John
Plumeyer, Henning
Prins, Robert
Robyn, Phil
Said, Marco Maier
Sergeev, Andrey
Smith, Gary L.
Smith, Paul
Stockton, John
Stewart, Bill
Suhovey, Alexander
Tacke, Matthias
Takashi, Ootani
Vargo, Todd
Westlake, Frank