home *** CD-ROM | disk | FTP | other *** search
- echo off
- rem
- rem ALIASES.BAT -- 4DOS Sample Alias File
- rem
- rem
- rem The aliases in this file are designed to give you some examples of
- rem how 4DOS aliases can be used and the power they have. It is not
- rem intended to be an exhaustive list, and many of these may not be
- rem appropriate for your needs. But they should give you a feel for how
- rem to use aliases to help get your work done.
- rem
- rem CAUTION: These aliases are EXAMPLES. We do NOT promise that they
- rem will work properly when run on your system. They are simply intended
- rem to show what's possible and give you a feel for how to write your
- rem own set of aliases. You may find some of them useful, but others
- rem may fail or have unintended effects when they are run on a system
- rem other than the one they were designed for.
- rem
- rem We suggest you put your standard aliases are in a self-contained
- rem batch file like this one which can be invoked from AUTOEXEC. That
- rem way the file can also be re-invoked after it is edited, to re-
- rem install the aliases.
- rem
- rem
- rem First, delete all previous aliases.
- rem
- unalias *
- rem
- rem The next few aliases set up some directory commands that provide
- rem shorthand ways to view the directory in several different formats
- rem (see the DIR command in the manual for more details).
- rem
- rem Note that none of these aliases has any arguments specified (%1,
- rem %2, etc.). This means that all arguments on the actual command line
- rem will be appended to the alias text. For example:
- rem
- rem d2 x*
- rem
- rem is equivalent to:
- rem
- rem dir /2 x*
- rem
- rem and:
- rem
- rem d2 x* y* z*
- rem
- rem is equivalent to:
- rem
- rem dir /2 x* y* z*
- rem
- alias d dir /p
- alias d2 dir /2
- alias de dir /oe
- alias whereis dir /dp
- rem
- rem The following aliases are more shorthand: dd and du (directory
- rem down and directory up) for pushd and popd, l for list, etc.
- rem
- alias dd pushd
- alias du popd
- alias l list
- alias clr mode mono
- rem
- rem Most of the next few aliases use arguments. Note that the ones
- rem which do use arguments have the alias text in back-quotes. These
- rem are back-quotes, like this `` not single quotes like this ''; they
- rem are the character above the tilde ~~ on most PC keyboards.
- rem
- rem Without the back-quotes the argument names (%1, %2, etc.) will be
- rem filled in when the alias is created instead of when it is run.
- rem You can accomplish the same effect as the back-quotes by using
- rem two % signs in a row. For example the "ov" alias below is written
- rem as:
- rem `cd ..\%1`
- rem
- rem but could also be written as:
- rem
- rem cd ..\%%1
- rem
- rem Here's what these aliases do:
- rem
- rem sdel: Allows you to select files for deletion from a subset
- rem of files as specified in the command argument. For
- rem example:
- rem
- rem sdel *.obj
- rem
- rem will allow you to select files to delete from a list
- rem of all .obj files. (See the SELECT command in the
- rem manual for more details).
- rem
- rem up: Moves "up" in the directory tree, i.e. to the parent
- rem directory.
- rem
- rem ov: Moves "over" in the directory tree, to another subdi-
- rem rectory which has the same parent as the current
- rem directory.
- rem
- alias sdel `select del (%1)`
- alias up cd ..
- alias ov `cd ..\%1`
- rem
- rem The next two aliases show how arguments can be passed to commands.
- rem In both cases the argument given when the alias is invoked is passed
- rem to the program at the appropriate place in its command string.
- rem
- rem Note another effect of the back-quotes in the lp alias: they cause
- rem the redirection symbol > to be executed when the alias is invoked.
- rem Without the back-quotes this symbol would redirect the output from
- rem the alias command itself, which would be meaningless.
- rem
- alias lp `lpr -u %1 >lpt1`
- alias ps `d:\peri\ps /t:%1 /e:4`
- rem
- rem The next few aliases demonstrate several things. Some use the
- rem command separator character ^ to include multiple commands in
- rem the alias. The last two (pc and back) use the alias called px
- rem to do their job. In fact px was designed for "internal" use by
- rem other aliases in this file, though it could be used elsewhere as
- rem well. Note that, while px is set up before it is referenced in
- rem other aliases, this is not really necessary, because any command
- rem in one alias which refers to another is handled when the alias is
- rem invoked, not when it is set up with the alias command.
- rem
- rem Here's what each alias does:
- rem
- rem nd: Creates a new directory below the current directory,
- rem then changes to it.
- rem
- rem w: Saves the current directory, changes to the wp
- rem directory on drive c:, runs the wp program using
- rem the first argument on the command line, and
- rem restores the original directory when done.
- rem
- rem zap: Deletes all the .bak files in the current directory,
- rem then does a wide directory listing.
- rem
- rem px: "Pushes" a different directory, executes a command,
- rem and then goes back to the original directory. See
- rem PUSHD and POPD in the manual for more details.
- rem
- rem pc: Changes to the \comm directory on drive c:, runs
- rem the program called pcomm, then returns to the
- rem drive and directory in use when the command was
- rem executed.
- rem
- rem back: Changes to the \backup directory on drive d:, runs
- rem the program called tape, then returns to the previous
- rem drive and directory.
- rem
- alias nd `md %1^cd %1`
- alias w `pushd c:\wp^wp %1^popd`
- alias zap `del *.bak^dir /w`
- alias px `pushd %1^%2^popd`
- alias pc px c:\comm pcomm
- alias back px d:\backup tape
- rem
- rem The following aliases make use of the %& argument. This argument
- rem means "all of the arguments on the command line". For example:
- rem
- rem zap2 *.bak *.lst *.bk!
- rem
- rem expands to:
- rem
- rem erase *.bak *.lst *.bk!^chkdsk^dir /w
- rem
- alias zap2 `erase %&^chkdsk^dir /w`
- alias ed `edit %&^del *.bak`
- rem
- rem The following two aliases, taken from page 22 of the manual, show
- rem how to combine alias with keystack to invoke a program and pass
- rem parameters to it. See the manual for details on what they do.
- rem Note that the 0s in the keystack strings simulate an empty keyboard
- rem buffer; the 13s are carriage returns.
- rem
- alias 321 `keystack 0 13 0 13 0 13 0 13 0 13 "/fr" 0 "%1" 13^123`
- alias drpt `pushd c:\data^keystack "use times index times" 13 "report form timerep to print" 13 "quit" 13^dbase^popd`
-