Ack! This site is moving to tomhorsley.com since Comcast's efforts to improve their world's worst customer service ranking apparently include terminating web hosting for their existing customers.
This document and the ntcli collection of programs and source code are all Copyright © Tom Horsley, 1998 (unless otherwise noted in the source files). All rights reserved. The right to unlimited not for profit distribution and use of these programs is granted to anyone who agrees to keep the copyright notice intact and not alter the programs. (In other words, if you want to make money off of these, I want some of it too :-).
It should also be noted that the word Unix which is used in various places is copyrighted by someone, but I'm darned if I can keep track of who these days (AT&T?, SCO?, HP?, Unix International?, X/Open?, someone like that...).
ntcli tool set is a random collection of NT command
line tools (hence the name). They are functionally very similar to tools of
the same name under Unix, but have a windows flavor and are built to
function in the windows spirit, giving access to windows features (while
trying not to lose any of the Unix functionality).
By no means all possible Unix tools are available here. Only a handful of commands are implemented (see Commands). Mostly they are commands I can't live without, or commands I happened to need while trying to get some makefile to work. No attempt has been made to be logical about the selection of commands.
All of these commands share the same command line processing which
implements wildcard processing much as the Unix shell does, but with extra
DOS-like features (such as being able to use wildcards in the device letter
position of names). The possible wildcard features are the
character which matches any string of characters, the
matches any single character, and the
 character class
construct which matches any character in the set of characters listed
If the first character inside a character class is
the class matches all characters except the ones listed. Ranges of
characters may be specified with a
- (hyphen) separating the
two characters which define either end of the range.
[c-z]:[!0-9]*.cmatches any files with the
.csuffix which do not begin with a digit on any disks from
*matches any files in current directory (unlike DOS in which you would need to write
c:\*\include\*.hmatches any files with the
.hsuffix in directories named
includedirectly underneath any directory on disk
In addition to sharing common wildcard processing, the commands also share common processing of registry information which may be used to install default options for the commands. Every command determines the name it was invoked with, then looks in the registry under the key:
for option settings specific to that program (you can copy the programs to
different names and give them different default behaviors based on the
name). The string progname in this key is the base name of the
program minus the
It will also consult the key:
HKEY_CURRENT_USER\Software\NTCLI\Global Defaults\1.0 for
option settings which are common to all the
DWORD values may be set to either 1 or 0
(meaning on or off) in either of the keys:
AllowForwardSlashSet to 1 to allow the forward slash character to be treated as a directory separator as well as the backslash character. Set to 0 if only backslash should be allowed. The default for this value is 1 if not specified in registry.
SeeHiddenFilesSet to 1 to allow hidden files to be visible to wildcard expansion. Set to 0 to allow them to remain hidden. The default for this value is 0 if not specified in registry.
CaseSensitiveWildcardsSet to 1 to make wildcard expansion case sensitive. Set to 0 to make it insensitive to case. The default for this value is 0 if not specified in registry.
In addition to those values, the program specific key may also contain a
multi-string value named
Options. These will be added to the
beginning of the command line options so the program always looks as though
it were invoked with those options.
No automatic setup program is available for these keys. You need to use the registry editor to define them if you want to change the defaults.
Commands The five commands defined so far are:
Just like the Unix basename. Strips off the leading directory components of a filename passed as an argument. If two arguments are given interprets the 2nd as a suffix and strips that off the end of the basename if it is present. Prints the resulting name to standard output.
Pretty much like the Unix cat command, but has a couple of extra win32 arguments. Basically it reads all the files listed on the command line and prints their contents to standard output. The options are:
-umake output be unbuffered
-ssilently ignore file arguments which don't exist
-vprint escape code for unprintable characters
-tprint escape codes for tabs and form feeds
-eprint a $ at end of each line
-Tread and write all files in text mode
-Bread and write all files in binary mode
Compares two files byte for byte. The options are:
-lshow long listing of all file differences
-sbe silent and just set exit code to non-zero if the files do not match
-Tread files in text mode
-Bread files in binary mode
Deviates more from the Unix that any other command because file permissions simply aren't organized the same way on Windows as on Unix and it can't really make sense to emulate Unix exactly. There are a lot of special win32 options as well as a different way to display file attributes in long listings.
-ado not hide hidden or system files or the . and .. directory names
-bescape unprintable characters to octal
-cuse create time of file for sort and list
-dshow directory names, not directory contents
-hprint help summary
-jconvert names to all lower case for printing and sorting
-luse a long listing format
-mfill width with a comma separated list of entries
-oshow both long and short names of file in -l listing (for those files which have a short 8.3 alias)
-pappend a character indicating kind of non-executable file
-qescape unprintable characters to a question mark
-rreverse order while sorting
-tuse modification time of file for sort and list
-uuse last access time of file for sort and list
-wgive argument to specify screen width
-xlist across lines rather than down columns
-Ado not list the . and .. entries, but show other hidden files
-Clist entries by columns
-Duse DOS format for names and show backslash as the directory separator rather than forward slash
-Fappend a character indicating kind of files
-Gturn on display of group information in -l listing
-Igive argument to specify wild card pattern to be ignored
-Hprint help summary
-Jconvert names to all upper case for printing and sorting
-Muse only the short 8.3 format MS-DOS names of files
-Ndo not quote entry names
-Oturn on display of owner information in -l listing
-Qenclose entry names in double quotes
-Rlist subdirectories recursively
-Ssort by file size
-Ulist entries in unspecified order without any sorting
-Xsort alphabetically by entry extension
-1list one file per line
When generating the long format listing (using the
option), the normal Unix 9 character permission bits string is printed
instead as a seven character string summarizing the file attributes. In
left to right order the characters are either printed as
no attribute, or:
dfile is a directory
rfile is readonly
xfile is an executable or a directory
hfile is hidden
sfile is a system file
afile is marked for archiving
tfile is marked as temporary
The executable information is merely a guess based on the file suffix.
At the moment, only the suffixes
.com are considered executable.
The owner and group information (if requested with the
-G options) can only be determined for file systems (such
as NTFS) which actually support security information on files.
The rm command is used to remove files. It is very nearly identical to the Unix version:
-rrecursively delete whole directory trees
-fdo not generate errors about file that could not be deleted
-iinteractively prompt for the action to take on each file
-Ipretend rm is running interactively in a console window
-I option was added for use in places such as an emacs
shell window where rm is running with pipes as standard in and out. Without
-f option, rm will interactively prompt to see if you
really meant it when you delete a readonly file, but only if it thinks it
is running on a console.
When it does prompt with a yes or no question about deleting a file, any
reply starting with a
Y will cause it to
delete the file (or try to, anyway).
Nothing special is required to install, just unzip the
ntclibin.zip archive in some directory and add that directory
to your path. The tools should work under Windows/NT or Windows/95/98. You
can use the registry editor to define any options you want to change (see
Registry). Finally, you might want to put the
ntcli.html document somewhere you can find it.
The source code is also available in
ntclisrc.zip. If you
are already setup to run Visual C++, you should just be able to unzip the
file and run
nmake. Before you ask, I have no idea if it works
with the Borland compiler or any other compiler.
The world doesn't really need yet another set of Unix on DOS tools, but at least these work exactly the way I want them to and are reasonably small.
If you have any comments, bug fixes, etc., you can check out my contact info. (but don't expect too much - this is strictly a free time activity for me).
Naturally, the real reason I put these up on my web page is to lure unsuspecting victims seeking free software to my home page where they will read about my political ideas and join in an unstoppable wave of grass roots action to bring performance based government to the world (or something like that, anyway).