Purpose: | Interactively select files for a command |
Format: | SELECT [/= /1 /A[[:][-][+]rhsadecijopt] /C /D /E /H /I"text" /J /L /O:[-]acdeginorstuz /Q /T:acw /X /Z] [command] ... (files...)... |
command | The command to execute with the selected files. |
files | The files from which to select. File names may be enclosed in either parentheses or square brackets. The difference is explained below. |
File Selection
Supports command dialog, extended wildcards, ranges, multiple file names, and include lists. Ranges must appear immediately after the SELECT keyword.
Internet: Can be used with FTP servers. See Using FTP/HTTP Servers.
Usage:
SELECT allows you to select files for internal and external commands by using a "point and shoot" display. You can have SELECT execute a command once for each file you select, or have it create a list of files for a command to work with. The command can be an internal command, an alias, an external command, or a batch file. If you don't specify any arguments, SELECT will display its command dialog.
If you use parentheses around the files, SELECT executes the command once for each file you have selected. During each execution, one of the selected files is passed to the command as a parameter. If you use square brackets around files, the SELECTed files are combined into a single list, separated by spaces. The command is then executed once with the entire list presented as part of its command line parameters.
If the last argument on the line is a single (, it is interpreted as the beginning of a command group. SELECT will append the following lines (in a batch file) or prompt you for more input (at the command line) until it gets a closing ).
SELECT can also select files on FTP servers. For example:
select del (ftp://ftp.domain.com/)
You can also use the IFTP command to start an FTP session on a server, and then use an abbreviated syntax to specify the files and directories you want. For more information, see Using FTP/HTTP Servers and IFTP.
SELECT will colorize the directory listing. See DIR for more information on directory colorization.
Using the SELECT File List
When you execute the SELECT command, the file list is displayed in a full-window format which includes a top-line status bar and shows the command to be executed, the number of files marked, and the number of Kbytes in those files.
SELECT supports the mouse for selecting and scrolling the list. You can also use the cursor up, cursor down, PgUp, and PgDn keys to scroll through the file list. You can also use character matching to find specific files, just as you can in any popup window. While the file list is displayed you can enter any of the following keys to select or unselect files, display files, execute the command, or exit:
space | Select a file, or unselect a marked file |
+ | Select a file (all products), or unselect a marked file |
- | Unselect a marked file |
* | Reverse all of the current marks (except those on subdirectories). If no files have been marked you can use * to mark all of the files |
/ | Unselect all files |
Ctrl-L | View the current highlighted file with LIST. When you exit from LIST, the SELECT screen will be restored |
Enter | Execute the command with the marked files, or with the currently highlighted file if no files have been marked |
Esc | Skip the files in the current display and go on to the next file specification inside the parentheses or brackets (if any) |
Ctrl-C or | Cancel the current SELECT command entirely |
Ctrl-Break
On FAT drives the file list is shown in standard FAT directory format, with names at the left and descriptions at the right. On LFN drives the format is similar but more space is allowed for the name, and the description is not shown. In this format long names are truncated if they do not fit in the allowable space. For a short-name format (including descriptions) on long filename drives, use the /X and / or /Z switches.
When displaying descriptions in the short filename format, SELECT adds a right arrow at the end of the line if the description is too long to fit on the screen. This symbol will alert you to the existence of additional description text. You can use the left and right arrow keys to scroll the description area of the screen horizontally and view the additional text.
Creating SELECT Commands
In the simplest form of SELECT, you merely specify the command and then the list of files from which you will make your selection(s). For example:
select copy (*.cmd *.exe) q:\
will let you select from among the .CMD files in the current directory, and will then invoke the COPY command to copy each file you select to the root of drive Q:. After the .CMD files are done, the operations will be repeated for the .EXE files.
If you want to select from a list of all the .CMD and .EXE files mixed together, create an include list inside the parentheses by inserting a semicolon:
select copy (*.cmd;*.exe) a:\
Finally, if you want the SELECT command to send a single list of files to COPY, instead of invoking COPY once for each file you select, put the file names in square brackets instead of parentheses:
select copy [*.cmd;*.exe] a:\
If you use brackets, you have to be sure that the resulting command (the word COPY, the list of files, and the destination drive in this example) does not exceed the command line length limit. The current line length is displayed by SELECT while you are marking files to help you to stay within that limit.
The parentheses or brackets enclosing the file name(s) can appear anywhere within the command; SELECT assumes that the first set of parentheses or brackets it finds is the one containing the list of files from which you wish to make your selection.
When you use SELECT on an LFN drive, you must quote any file names inside the parentheses which contain white space or special characters. For example, to copy selected files from the Program Files" directory to the E:\SAVE directory:
select copy ("Program Files\*") e:\save\
File names passed to the command will be quoted automatically if they contain white space or special characters.
The list of files from which you wish to select can be further refined by using date, time, size and file exclusion ranges. The range(s) must be placed immediately after the word SELECT. If the command is an internal command that supports ranges, an independent range can also be used in the command itself.
You cannot use command grouping to make SELECT execute several commands, because SELECT will assume that the parentheses are marking the list of files from which to select, and will display an error message or give incorrect results if you try to use parentheses for command grouping instead. (You can use a SELECT command inside command grouping parentheses, you just can't use command grouping to specify a group of commands for SELECT to execute.)
Advanced Topics
If you don't specify a command, the selected filename(s) will become the command. For example, this command defines an alias called UTILS that selects from the executable files in the directory C:\UTIL, and then executes them in the order marked:
alias utils select (c:\util\*.cmd;*.exe;*.btm;*.bat)
If you want to use filename completion to enter the filenames inside the parentheses, type a space after the opening parenthesis. Otherwise the command line editor will treat the open parenthesis as the first character of the filename.
With the /I option, you can select files based on their descriptions. SELECT will display files if their description matches the text after the /I switch. The search is not case sensitive. You can use wildcards and extended wild cards as part of the text.
When sorting file names and extensions for the SELECT display, TCC normally assumes that sequences of digits should be sorted numerically (for example, the file DRAW2 would come before DRAW03 because 2 is numerically smaller than 03), rather than strictly alphabetically (where DRAW2 would come second because "2" comes after "0"). You can defeat this behavior and force a strict alphabetic sort with the /O:a option.
Options:
/A[:] | Select only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:. |
You can specify /A:= to display a dialog to help you set individual attributes.
/C | Display per-file and total compression ratios on compressed drives. The compression ratio is displayed instead of the file description. The ratio is left blank for directories and files with a length of 0 bytes, and for files on non-compressed drives. The compression ratios will not be visible on LFN drives unless you use /Z to switch to the short filename format. Only compressed NTFS drives are supported. See DIR /C for more details on how compression ratios are calculated. |
/I"text" | Display filenames by matching text in their descriptions. The text can include wildcards and extended wildcards. The search text must be enclosed in double quotes, and must follow the /I immediately, with no intervening spaces. You can select all filenames that have a description with /I"[?]*", or all filenames that do not have a description with /I"[]". |
n | Sort by filename |
- | Reverse the sort order for the next option. |
a | Sort names and extensions in standard ASCII order, rather than sorting numerically when digits are included in the name or extension. |
c | Sort by compression ratio (the least compressed file in the list will be displayed first). For information on supported compression systems see /C above. |
d | Sort by date and time (oldest first). |
e | Sort by extension. |
g | Group subdirectories together. |
i | Sort by the file description (ignored if /C or /O:c is also used). |
o | Sort by owner |
r | Reverse the sort order for all options. |
s | Sort by size. |
u | Unsorted. |
/T:acw | Specify which of the date and time fields on an LFN drive should be displayed and used for sorting: |
a | Last access date and time (access time is not saved on VFAT and FAT32 volumes). |
c | Creation date and time. |
w | Last write date and time (default). |