home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / menu / 4dos.lzh / ALIASES.BAT < prev    next >
Encoding:
DOS Batch File  |  1989-02-15  |  7.2 KB  |  179 lines

  1. echo off
  2. rem
  3. rem                     ALIASES.BAT -- 4DOS Sample Alias File
  4. rem
  5. rem
  6. rem     The aliases in this file are designed to give you some examples of
  7. rem     how 4DOS aliases can be used and the power they have.  It is not
  8. rem     intended to be an exhaustive list, and many of these may not be
  9. rem     appropriate for your needs.  But they should give you a feel for how
  10. rem     to use aliases to help get your work done.
  11. rem
  12. rem     CAUTION:  These aliases are EXAMPLES.  We do NOT promise that they
  13. rem     will work properly when run on your system.  They are simply intended
  14. rem     to show what's possible and give you a feel for how to write your
  15. rem     own set of aliases.  You may find some of them useful, but others
  16. rem     may fail or have unintended effects when they are run on a system
  17. rem     other than the one they were designed for.
  18. rem
  19. rem     We suggest you put your standard aliases are in a self-contained
  20. rem     batch file like this one which can be invoked from AUTOEXEC.  That
  21. rem     way the file can also be re-invoked after it is edited, to re-
  22. rem     install the aliases.
  23. rem
  24. rem
  25. rem     First, delete all previous aliases.
  26. rem
  27. unalias *
  28. rem
  29. rem     The next few aliases set up some directory commands that provide
  30. rem     shorthand ways to view the directory in several different formats
  31. rem     (see the DIR command in the manual for more details).
  32. rem
  33. rem     Note that none of these aliases has any arguments specified (%1,
  34. rem     %2, etc.).  This means that all arguments on the actual command line
  35. rem     will be appended to the alias text.  For example:
  36. rem
  37. rem             d2 x*
  38. rem
  39. rem     is equivalent to:
  40. rem
  41. rem             dir /2 x*
  42. rem
  43. rem     and:
  44. rem
  45. rem             d2 x* y* z*
  46. rem
  47. rem     is equivalent to:
  48. rem
  49. rem             dir /2 x* y* z*
  50. rem
  51. alias d dir /p
  52. alias d2 dir /2
  53. alias de dir /oe
  54. alias whereis dir /dp
  55. rem
  56. rem     The following aliases are more shorthand:  dd and du (directory
  57. rem     down and directory up) for pushd and popd, l for list, etc.
  58. rem
  59. alias dd pushd
  60. alias du popd
  61. alias l list
  62. alias clr mode mono
  63. rem
  64. rem     Most of the next few aliases use arguments.  Note that the ones
  65. rem     which do use arguments have the alias text in back-quotes.  These
  66. rem     are back-quotes, like this `` not single quotes like this ''; they
  67. rem     are the character above the tilde ~~ on most PC keyboards.
  68. rem
  69. rem     Without the back-quotes the argument names (%1, %2, etc.) will be
  70. rem     filled in when the alias is created instead of when it is run.
  71. rem     You can accomplish the same effect as the back-quotes by using
  72. rem     two % signs in a row.  For example the "ov" alias below is written
  73. rem     as:
  74. rem             `cd ..\%1`
  75. rem
  76. rem     but could also be written as:
  77. rem
  78. rem             cd ..\%%1
  79. rem
  80. rem     Here's what these aliases do:
  81. rem
  82. rem             sdel:   Allows you to select files for deletion from a subset
  83. rem                     of files as specified in the command argument.  For
  84. rem                     example:
  85. rem
  86. rem                             sdel *.obj
  87. rem
  88. rem                     will allow you to select files to delete from a list
  89. rem                     of all .obj files.  (See the SELECT command in the
  90. rem                     manual for more details).
  91. rem
  92. rem             up:     Moves "up" in the directory tree, i.e. to the parent
  93. rem                     directory.
  94. rem
  95. rem             ov:     Moves "over" in the directory tree, to another subdi-
  96. rem                     rectory which has the same parent as the current
  97. rem                     directory.
  98. rem
  99. alias sdel `select del (%1)`
  100. alias up cd ..
  101. alias ov `cd ..\%1`
  102. rem
  103. rem     The next two aliases show how arguments can be passed to commands.
  104. rem     In both cases the argument given when the alias is invoked is passed
  105. rem     to the program at the appropriate place in its command string.
  106. rem
  107. rem     Note another effect of the back-quotes in the lp alias:  they cause
  108. rem     the redirection symbol > to be executed when the alias is invoked.
  109. rem     Without the back-quotes this symbol would redirect the output from
  110. rem     the alias command itself, which would be meaningless.
  111. rem
  112. alias lp `lpr -u %1 >lpt1`
  113. alias ps `d:\peri\ps /t:%1 /e:4`
  114. rem
  115. rem     The next few aliases demonstrate several things.  Some use the
  116. rem     command separator character ^ to include multiple commands in
  117. rem     the alias.  The last two (pc and back) use the alias called px
  118. rem     to do their job.  In fact px was designed for "internal" use by
  119. rem     other aliases in this file, though it could be used elsewhere as
  120. rem     well.  Note that, while px is set up before it is referenced in
  121. rem     other aliases, this is not really necessary, because any command
  122. rem     in one alias which refers to another is handled when the alias is
  123. rem     invoked, not when it is set up with the alias command.
  124. rem
  125. rem     Here's what each alias does:
  126. rem
  127. rem             nd:     Creates a new directory below the current directory,
  128. rem                     then changes to it.
  129. rem
  130. rem             w:      Saves the current directory, changes to the wp
  131. rem                     directory on drive c:, runs the wp program using
  132. rem                     the first argument on the command line, and
  133. rem                     restores the original directory when done.
  134. rem
  135. rem             zap:    Deletes all the .bak files in the current directory,
  136. rem                     then does a wide directory listing.
  137. rem
  138. rem             px:     "Pushes" a different directory, executes a command,
  139. rem                     and then goes back to the original directory.  See
  140. rem                     PUSHD and POPD in the manual for more details.
  141. rem
  142. rem             pc:     Changes to the \comm directory on drive c:, runs
  143. rem                     the program called pcomm, then returns to the
  144. rem                     drive and directory in use when the command was
  145. rem                     executed.
  146. rem
  147. rem             back:   Changes to the \backup directory on drive d:, runs
  148. rem                     the program called tape, then returns to the previous
  149. rem                     drive and directory.
  150. rem
  151. alias nd `md %1^cd %1`
  152. alias w `pushd c:\wp^wp %1^popd`
  153. alias zap `del *.bak^dir /w`
  154. alias px `pushd %1^%2^popd`
  155. alias pc px c:\comm pcomm
  156. alias back px d:\backup tape
  157. rem
  158. rem     The following aliases make use of the %& argument.  This argument
  159. rem     means "all of the arguments on the command line".  For example:
  160. rem
  161. rem             zap2 *.bak *.lst *.bk!
  162. rem
  163. rem     expands to:
  164. rem
  165. rem             erase *.bak *.lst *.bk!^chkdsk^dir /w
  166. rem
  167. alias zap2 `erase %&^chkdsk^dir /w`
  168. alias ed `edit %&^del *.bak`
  169. rem
  170. rem     The following two aliases, taken from page 22 of the manual, show
  171. rem     how to combine alias with keystack to invoke a program and pass
  172. rem     parameters to it.  See the manual for details on what they do.
  173. rem     Note that the 0s in the keystack strings simulate an empty keyboard
  174. rem     buffer; the 13s are carriage returns.
  175. rem
  176. alias 321 `keystack 0 13 0 13 0 13 0 13 0 13 "/fr" 0 "%1" 13^123`
  177. alias drpt `pushd c:\data^keystack "use times index times" 13 "report form timerep to print" 13 "quit" 13^dbase^popd`
  178.  
  179.