home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SYSTEM / SETENVJW.ZIP / SETENV.SYN < prev    next >
Encoding:
Text File  |  1991-06-16  |  6.4 KB  |  235 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. setenv command line syntax:
  7.  
  8. <prog>    %rce    <variable>    <options>
  9.  
  10. setenv        <variable>    <no value>
  11.                 <value>
  12.                 %chgup
  13.                 %rep<del><text1><del><text2><del>
  14.                 %prompt    <prompt options> <message>
  15.  
  16. <prog>
  17.     setenv program to handle environment variables
  18.  
  19. <variable>
  20.     the name, the environment variable    
  21.     any valid environment variable you wish to define or re-define
  22.  
  23. <value>
  24.     a string of printable characters
  25.     the data portion for the environment variable
  26.     any number of <keys> can be imbedded in the character string
  27.  
  28. <del>
  29.     any one character, to delimit or to quote <text>
  30.     the delimiter must be consistent for the option used
  31.  
  32. <text>
  33.     a string of printable characters
  34.     any variable length text {maximum length 100}
  35.  
  36. <text1>
  37.     a string of printable characters
  38.     any variable length text {maximum length 100}
  39.  
  40. <text2>
  41.     a string of printable characters
  42.     any variable length text {maximum length 100}
  43.  
  44. <message>
  45.     a string of printable characters
  46.     is displayed on the console and the response is set into the <variable>
  47.  
  48. <keys>
  49.     special names that are imbedded in <value>
  50.     usually begining  with a % {percent sign}
  51.     a key will denote a special function like time
  52.  
  53. <options>
  54.     functions to preform for an environment variable
  55.  
  56. <prompt options>
  57.     subfunctions to perform for %prompt
  58.  
  59. %rce
  60.     is used when command.com has been called a second time
  61.     to set the environment variable in the root environment space
  62.  
  63.  
  64.  
  65.  
  66.  
  67. setenv command line syntax continued:
  68.  
  69. <options>
  70.  
  71.     <no value>
  72.         no data entered
  73.         environment variable by it's self to erase it
  74.     <value>
  75.         any length data for the environment variable
  76.         any number of <keys> can be imbedded in the data
  77.     %chgup
  78.         change the existing environment variable's data to uppercase
  79.     %rep<del><text1><del><text2><del>
  80.         replace any occurence  of <text1> with any occurence of 
  81.         <text2> in the  existing environment variable
  82.     %prompt    <prompt options> <message>
  83.         prompt the display with <messsage> for <variable>'s data
  84.  
  85. <prompt options>
  86.  
  87.     %def<def><text><del>
  88.         if no data is entered at the prompt then use <text>
  89.         no data entered is a soul carriage return
  90.     %noecho
  91.         when data is entered do not display it
  92.         necessary for passwords, 
  93.         remember to ersae the variable after use
  94.         
  95.     %timo=hh:mm:ss
  96.         exit prompt, if no data is entered in the time hh:mm:ss 
  97.         if no %def accompanies this option then %def// is assumed
  98.         ss for seconds, mm:ss for minutes, hh:mm:ss for hours
  99.     %upper
  100.         convert prompted / entered data to uppercase
  101.  
  102. <keys>
  103.     %cwd
  104.         the current working directory, will be "/" if at the top
  105.     %date1 or %date
  106.         the current date as dd:mm:yy, day first
  107.     %date2
  108.         the current date as mm:dd:yy, month first
  109.     %date3
  110.         the current date as yy:dd:mm, year first
  111.     %dosv
  112.         MS-DOS major version
  113.     %dosm
  114.         MS-DOS minor version
  115.     %drive
  116.         current working disk drive letter
  117.     %time
  118.         the current time as hh:mm:ss
  119.     %+n
  120.         plus "n"'s disk drive letter from current drive
  121.     %-n
  122.         minus "n"'s disk drive letter from current drive
  123.  
  124.  
  125.  
  126.  
  127.  
  128. setenv command examples:
  129.  
  130. To create a variable
  131.     setenv name John Wolchak
  132.  
  133. To erase a variable
  134.     setenv name
  135.  
  136. To prompt a question
  137.     setenv node %prompt Node name to connect to 
  138.  
  139. To prompt passwords
  140.     setenv pass %prompt %noecho Your password 
  141.  
  142. When you want to pass on a string with spaces in it to a batch file
  143.     batfile this_is_a_test
  144.     setenv name %%rep/_/ /
  145.  
  146. When you want to minimize parsing data, use uppercase
  147.     set name=John
  148.     setenv name %%chgup
  149.     or
  150.     setenv name %%prompt %%upper Your first name 
  151.  
  152. To given batch files startup options
  153.     prompt:
  154.     setenv ans %%prompt %%upper %%def/N/ Connect to the Network (Y/N) 
  155.     setenv ans %%rep/ES//
  156.     setenv ans %%rep/ //
  157.     setenv ans %%rep/O//
  158.     if "%ans%" == "Y" goto network
  159.     if not "%ans%" == "N" goto prompt
  160.  
  161. To give batch files startup options, that can be unattendable as well
  162.     prompt:
  163.     setenv ans %%prompt %%upper %%def/N/ %%tamo=20 Network Connect (Y/N) 
  164.     if "%ans%" == "Y" goto network
  165.     if not "%ans%" == "N" goto prompt
  166.  
  167. For timing test
  168.     setenv start Starting time %%time
  169.     myporg
  170.     setenv end Ending time %%time
  171.  
  172. For batch proceedures that move around and return
  173.     setenv retdrv %%drive:
  174.     setenv retdir %%cwd
  175.     ...
  176.     ...
  177.     %retdrv%
  178.     cd %retdir%
  179.  
  180. For programs that spawn by calling command.com
  181.     setenv %rce name John
  182. which is the same as
  183.     c:\command /c setenv %rce name John
  184.  
  185.  
  186.  
  187.  
  188.  
  189. setenv command examples continued:
  190.  
  191. To tell a program the start time, but you want it to start now.  The
  192. user normally would enter hh:mm:ss, but for the current time enter %time
  193.     setenv time %prompt Start time 
  194.     Start time
  195. answer:
  196.     Start time %time
  197.  
  198.  
  199.  
  200. setenv command special notes:
  201.  
  202.     In batch (BAT files) use %% to represent a single % for use 
  203. to SETENV.   ie. setenv drv_dir %%drive:%%cwd
  204. Which on the display screen would be:   ie. setenv drv_dir %drive:%cwd 
  205.  
  206.      In the preceding section scripts that would be in batch have 
  207. had %% in them.  In batch you can use %<environ_var>% to reflect the 
  208. value of a previous environment variable.  Make sure you have enough 
  209. environment space to store the amount of data you would need.  DOS 2.0 
  210. throught 3.20 have by default 160 bytes.
  211.  
  212.     SETENV can not expand the environment space.  The DOS SET 
  213. command can do that, by creating temporary variables with long values 
  214. and then removing them before any resident program is run.  Resident 
  215. programs are PRINT, MODE.  Once a resident program is run then the 
  216. environment space can not be expanded, because it precedes the resident
  217. code in memory.  Documentation is available for versions of DOS 2 thru 
  218. 3.20 that modify DOS to have a larger environment area beyond the normal 
  219. 160 bytes, as default values in Command.Com.  For DOS 3.30 and above 
  220. use the shell /E:xxxx option.  
  221.  
  222.     %prompt, %chgup, and %rep/// are replacments for a <value>
  223. field, not inaddition to.  The %prompt sub options are not suppose to 
  224. be order dependent, but the %prompt must precede the subfunctions.
  225.  
  226.     When you use %prompt and you do not use a %timo then the prompt 
  227. forever be displayed until a carriage return is entered.  Having no %def 
  228. and a %timo will assume %def// for the %prompt.  The time out is for the 
  229. first character you enter, after the first character is entered you have 
  230. forever to enter the rest of the text.
  231.  
  232.     There is some question where SETENV will run under MS-DOS V1.x.  
  233. I don't know because I have not seen either, as of yet.
  234.  
  235.