OPTION //directive=value is a ENDLOCAL

that means, it destroy the local Aliases and Functions and switch to global.

This was not the case last week, so it must have been installed with the last 3 or 4 builds.
I've wonder, that an Local defined Alias in my script suddenly never worked.

The following script demonstrate the problem, it defines Aliases in the SETLOCAL / ENDLOCAL block
wich will not more present after the OPTION Command, but the next alias definition after the
OPTION command will store in global Memory.
Code:
OPTION //ErrorColors=Bright Yellow on Bright Red

Color Black on Bright Yellow
Ver /R

Function /G
Function IsFunction=%%@IF[ISFUNCTION %%1,TRUE,FALSE]
Function IsAlias=%%@IF[ISALIAS %%1,TRUE,FALSE]
::
Alias PrintLineW=`Echo %@REPEAT[%1,%@DEC[%_COLUMNS]]`
::
Echo Alias PrintLineW ist %@ISALIAS[printlinew]
EchoS Alias PrintLineW: & Alias PrintLineW
PrintLineW *
::
Echo Aliaslist: & Alias
Echo Functionslist: & Function
:::::::::::::::::::::::::::::::::::::::
Setlocal
  UnAlias *
  UnFunction *
  Alias localPrintLineW=Echo %%@REPEAT[%%1,%%@DEC[%%_COLUMNS]]
  Function localIsFunction=%%@IF[IsFUNCTION %%1,TRUE,FALSE]
  Function localIsAlias=%%@IF[IsALIAS %%1,TRUE,FALSE]
  Echo Alias localPrintLineW ist %@localISALIAS[localprintlinew]
  EchoS Alias localPrintLineW: & Alias localprintlinew
  localPrintLineW +
  Echo Aliaslist: & Alias
  Echo Functionslist: & Function
  Memory | TAIL /N+16
    OPTION //BatchEcho=No & OPTION BatchEcho
  Memory | TAIL /N+16
  Echo Aliaslist: & Alias
  Echo Functionslist: & Function

  Echo Alias localPrintLineW ist %@localISALIAS[localprintlinew]
  EchoS Alias localPrintLineW: & Alias localprintlinew
  localPrintLineW #
  Alias localPrintLineW=Echo %%@REPEAT[%%1,%%@DEC[%%_COLUMNS]]
EndLocal
Echo Aliaslist: & Alias Local*
Echo Functionslist: & Function Local*
localPrintLineW !
 
Last edited:
May 20, 2008
10,573
78
Syracuse, NY, USA
This will do it too. (What is ZoneId anyway?).

Code:
v:\> type test.btm
setlocal
unalias *
alias foo=bar
echo Before:
alias
option //ZoneId=0
echo ========^r^nAfter:
alias | head /n2
Code:
v:\> test.btm
Before:
foo=bar
========
After:
hexe=d:\HWorks6\HWorks32.exe %$
e=textpad