Take Command : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)
The CurrCon Java Applet displays prices on this web page converted with today’s exchange rates into your local international currency, e.g. Euros, US dollars, Canadian dollars, British Pounds, Indian Rupees… CurrCon requires an up-to-date browser and Java version 1.7 or later, preferably 1.8.0_25. If you can’t see the prices in your local currency, Troubleshoot. Use Chrome for best results.

Take Command  Take Command
Introduction Copying just selected Dirs from one tree to Another
Redirection Caveats
File Timestamps COMSPEC
tcc Pet Tricks Configuring
Recursive Directory Processing Multitasking
Directory Diff Console Colours
Orphan Deleter Tips
Recursively Running a Utility on a Directory Tree Links

Introduction

A replacement for Windows W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32 and W8-64 command.com/cmd.exe that adds many extra features to BAT (Batch) file processing. It includes tcc.exe (née 4NT) for console batch files and a GUI (Graphic User Interface) equivalent. tcc.exe used to be sold separately. Even the familiar 4nt.exe is still there, but renamed to tcc.exe. The current version is 16.03.55 Last revised/verified: 2014-07-13.

It comes in two versions:

Take Command Versions
Version Cost Notes
TCC/LE free console tcc version only
Take Command $100.00 USD full version

I have only limited experience with the GUI component, (which does not appear to do much), though I bought a copy of Take Command on 2008-03-04. Within that you can download the 32 or 64-bit version. Everything following is about the tcc console batch component. Take Command/LE has been discontinued.

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 tcc installed you can redirect output:

or pipe output to another utility:

rem pipe stdout to more utility
javac.exe *.java | more

rem pipe output of stdout and stderr to more utility
javac.exe *.java |& more

or pipe with a tee to both redirect to a file and pipe:

When using tee with a pipe under tcc, 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 tcc. 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:
REM if myfile.java is newer than myfile.exe,
REM i.e. has a bigger timestamp,
REM then recompile.
REM note the [] around parms and lack of () around the if expression.
if %@FILEAGE[myfile.java] GT %@FILEAGE[myfile.exe] call recompile myfile

tcc Pet Tricks

Here are some of the sorts of tricks I use with tcc.

To calculate, add, subtract, multiply, divide use the @EVAL function.

Recursive Directory Processing

Here an example of recursively descending a directory tree and processing each directory it finds.

Directory Diff

This script compares two directories to detect missing, older, newer, or extra files.

Orphan Deleter

Here is an example of an iteration over all directories in a tree, and within that over each file. This is a useful script to keep to trees in synch by deleting files in the destination that no longer exist in the source.

Recursively Running a Utility on a Directory Tree

Here is the bloutall.btm script I use frequently. It runs the blout.exe utility on every file in the current directory, or optionally on every file in the directory tree. It only runs it on files with an extension that implies than contain readable text. blout.exe gets rid of excess blank lines and normalises line ending separators. I could also have implemented it with the simpler GLOBAL command.

Copying just selected Dirs from one tree to Another

Often you don’t want to process a whole directory true, just do the same thing to some or most of the directories in it. Here is an example where I provide a list of dirs I want to copy to the corresponding spot in another tree.

Caveats

COMSPEC

You can set up tcc as your default command processor by setting the SET environment COMSPEC parameter to:
X:\Program Files\JPSoft\TCMD13x64\tcc.exe /E:2500 /C
You can also do this more easily with X:\Program Files\JPSoft\TCMD13x64\tcmdbatch.btm

Configuring

Use the OPTION command to set the following parameters: Your C:\Users\user\AppData\Local\JPSoft\TCMD.INI file might look like this: Each window controlled by tcc can override the OPTION properties independently. In the upper left corner of each window, click properties: Run tccbatch.btm to associate .bat, .btm and/or .cmd with TakeCommand. This association can be wrecked by a paranoid virus checker.

You can configure the size of the CDD window by dragging it to the size you want with the mouse. This is a bit of a surprise since 4DOS/tcc/TakeCommand has been keyboard driven since the DOS days.

Multitasking

Especially if have multiple CPU (Central Processing Unit) cores, you can speed things up by dividing your work between several *.btm files and running the simultaneously. You then need to launch them, wait for them to finish, and keep them from interfering with each other. See Hints on how to coordinate tasks.

Console Colours

Controlling the colours of the foreground and background colours in Windows/Take Command console is baffling. Part of the problem is a legacy that goes back to DOS/4DOS days and hardware capable of only monochrome or 16 colours. I get the console colours behaving and as I want and they suddenly change all by themselves to unsuitable values. It is so frustrating I could spit. To start, let us look at eight places you can exert influence:

  1. TCC (Take Command Command line)OptionWindowsConsole  Palette. You would think this would define the 16 custom colours you can use for foreground and background colours. It is not quite that simple.
  2. TCCOptionWindowsANSI (American National Standards Institute). You would think this would give you wider choice of colours.
  3. TCCOptionWindows foreground and background colours. These would be the defaults for all consoles.
  4. The Take Command Option menu.
  5. C:\Users\user\AppData\Local\JPSoft\TCMD.INI . The palette colours are encoded here as decimal numbers.
  6. When a console is running, you can right click the top barpropertiescolour. You see a palette of 16 colours. You can define each palette entry with a 24-bit colour, and assign palette colours to foreground or background. Then click apply. This looks very straightforward, but it simply does not work the way you would expect. If you select a colour not on the palette, it will revert to a colour on the palette the next time you open the window. Sometimes changing the palette has no effect. Sometimes it disturbs the colours of other consoles. Sometimes you get some quite different colour from the one you asked for. Sometimes you get a garish primary colour. I would have thought, when you modify a running console, you must be modifying a *.lnk file. I discovered Windows sometimes creates temporary *.lnk files corresponding to *.bat or *.btm files in C:\Users\user\AppData\Roaming\Microsoft\Windows\Recent Items\ . However, these *.lnk files are missing the menu items to control colours (though they may internally have colour-controlling fields). I thought perhaps Windows/Take Command might be hiding the colour information in the registry somewhere, but I could not find it.
  7. Similar to a running console, you can right click on a shortcut *.lnk file and configure its colours, so long as it is on the desktop, not on the task bar.
  8. You can embed commands like this is your *.bat and *.btm files.
    cls bright white on blue
    This gives you dynamic control of colours, but you are limited to a very small set of inappropriate colours.

Try fooling around with all eight places before you give up.

Given that the whole console colour mechanism is broken, here is a strategy to make it work reasonably stably.

  1. Inside the TCC OPTION command, configure your palette with the 16 colours you want to use as foreground and background colours in your consoles. Never again change these.
  2. Catch consoles running and configure them. Just select from the palette. Do not define any new colours.

In future, the format of the *.lnk file should be changed so that you can configure regular, error and popup forground and background colours with 24-bit colours, completely independent from any other *.lnk file, without being limited to a 16-colour palette. Nothing you can do to one *.lnk file should screw up the colours in another. The colours should not change unless you explicitly change them. Perhaps you should be allowed a layer of indirection, e.g. specify colours to be the same as some other *.lnk. Then you could change the colour scheme of many *.lnk files by changing one master *.lnk.

For now, you can set the colours to anything you want, but they will stick for only one session. What a flipping mess! As my math professor Melzak used to say Somebody should be shot.

Tips


This page is posted
on the web at:

http://mindprod.com/jgloss/takecommand.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\takecommand.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
no blog for this page
IP:[65.110.21.43]
Your face IP:[54.196.119.93]
You are visitor number