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&nbsp:-).

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...).


The 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 ? which matches any single character, and the [] character class construct which matches any character in the set of characters listed inside the [] characters.

If the first character inside a character class is !, then 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.

Some examples:


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:

HKEY_CURRENT_USER\Software\NTCLI\progname\1.0 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 .exe suffix.

It will also consult the key:

HKEY_CURRENT_USER\Software\NTCLI\Global Defaults\1.0 for option settings which are common to all the ntcli programs.

The following DWORD values may be set to either 1 or 0 (meaning on or off) in either of the keys:

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:


Compares two files byte for byte. The options are:


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.

When generating the long format listing (using the -l 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 - for no attribute, or:

The executable information is merely a guess based on the file suffix. At the moment, only the suffixes .exe, .cmd, .bat, and .com are considered executable.

The owner and group information (if requested with the -O or -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:

The -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 the -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 or 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.

Deep Thoughts

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).

Page last modified Sat Apr 4 00:07:47 1998