A replacement for Windows W2K/XP/W2K3/Vista
command.com/cmd.exe that adds many extra features to
BAT file processing. It includes 4NT for console batch files and a GUI
equivalent. Even the familiar 4NT.exe is still there,
so you don’t have to change anything but the name of the install directory.
You can upgrade from 4NT for the same price as an upgrade from an earlier
version of Take Command. I have only limited experience with the GUI component,
(which does not apear to do much), though I bought a copy of Take Command on 2008-03-04
so everything following is about the 4NT console batch component.
Redirection
It is initially of interest to Java programmers because it lets you redirect
both STDOUT and STDERR to files, pipes or tees. The feature allows you to
redirect the output of javac.exe,
i.e. the error messages, which appear on STDERR, to a file, or to both a file
and the console. Why is that important? Capturing the error messages from javac.exe
can be a hassle since they scroll off the screen faster than you can read them.
Ordinary > redirection won’t capture them to
a file because they are going to STDERR, not STDOUT.
Once you have 4NT installed you can redirect output:
or pipe output to another utility:
javac.exe *.java | more
javac.exe *.java |& more
or pipe with a tee to both redirect to a file and pipe:
When using tee with a pipe under 4NT, the programs on
the two ends of the pipe run simultaneously, not sequentially as in 4DOS. This
means more starts producing output right away. It does
not need to wait until the compile finishes.
Programs don’t have to be on the path to start them with 4NT. They just
need an Registry App Paths entry so there is
no need to put a directory on the path unless it contains several programs. This
keeps your path short, simple and fast.
File Timestamps
You can play with timestamps (improperly called ages)
like this:
if %@FILEAGE[myfile.java] GT %@FILEAGE[myfile.exe] call recompile myfile
4NT Pet Tricks
Here are some of the sorts of tricks I use with 4NT.
Here an example of recursively descending a directory tree and processing each
directory it finds.
Here is an example that compares two directories, looking for mismatches,
missing, older, newer, or extra files.
Caveats
- The biggest problem with 4NT is you may not distribute it to you customers in
any way. If they want to run your bat files they must
buy and install 4NT for themselves. There is no such thing an a 4NT runtime.
- There is a version of 4NT for Windows W95/W98/Me called 4DOS.
- I have encountered only one bug: CDD /S DE will not
work unless a C: drive exists. You can work around
that by providing it with a dummy one with SUBST C: D:\
- I think this is now fixed but in version 4.01, wildcards on long file names will
be performed on both long and short filenames, so often you get two matches on
the same file! The result in you often notice 4NT running a utility twice when
you use wildcards.
- You can install it as your official command processor, replacing cmd.exe
with by setting the COMSPEC environment variable to:
- With Vista, the registration key can mysteriously disappear. Use the inikey
version to keep it in a file instead of the flaky registry.
- With Vista, the defender will keep asking you for permission to run 4NT. Change
the short cut you use to invoke 4NT in the for all users option to tell
it not to run as administrator.
COMSPEC
You can set up 4NT as your default command processor by setting the SET
environment COMSPEC parameter to:
"F:\Program Files\JPSoft\4NT8\4NT.EXE" /E:2500 /C
Configuring
Use the OPTION command to set the following parameters:
- register, where you put your registration key. Be careful not to hit the remove
registration button, placed where you would expect to find an OK button.
- misc: extended directory search: 2. This makes CDD a very useful command to jump
to a directory on any drive just by typing a few letters of its name. It creates
an auxiliary list of all directories in C:\jpstree.idx
or in C:\users\ user\AppData\Local\JPSoft\jpstree.idx
in Vista.
- misc: ntsc descriptions off
- for colours try:
| use |
background |
foreground |
| output |
bright cyan |
#96ffff |
black |
#000000 |
| input |
bright cyan |
#96ffff |
blue |
#0000ff |
| list |
white |
#ffffff |
green |
#00ff00 |
| select |
white |
#ffffff |
red |
#ff0000 |
Each window controlled by 4NT can override the OPTION properties independently.
In the upper left corner of each window, click properties:
- shortcut : start in : your usual working directory.
- 14 point font
- screen buffer: 80x5000
- Window size: 80x40
- Edit options: insert mode and quickedit mode
- Screen background: 200-255-255 : pale cyan.