1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

parsing issue in command GLOBAL

Discussion in 'Support' started by Stefano Piccardi, Oct 25, 2011.

  1. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    It appears that the parser doesn't like when it finds a variable between GLOBAL and its command (in batch files and command lines):
    Code:
    V:\...\TCC>ver
    
    TCC  13.00.27   Windows XP [Version 5.1.2600]
    
    V:\...\TCC>set x=/Q
    
    V:\...\TCC>global %x echo %_cwd
    
    GLOBAL: V:\bin\totalcmd\util\TCC
    TCC: Unknown command "/Q"
    
    V:\...\TCC>global /Q echo %_cwd
    V:\bin\TCC
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,058
    Likes Received:
    30
    I imagine that global does not want to screw up the command so it doesn't do
    variable expansion ... just looks for switches and saves the rest to be expanded
    and executed later. Since the command itself seems more likely to start with a
    variable (than options being in a variable) I imagine allowing options in a
    variable would be pretty hard to do (and of little value).

    On Tue, 25 Oct 2011 10:17:26 -0400, Stefano Piccardi <>
    wrote:

    |It appears that the parser doesn't like when it finds a variable between GLOBAL and its command (in batch files and command lines):
    |
    |Code:
    |---------
    |V:\...\TCC>ver
    |
    |TCC 13.00.27 Windows XP [Version 5.1.2600]
    |
    |V:\...\TCC>set x=/Q
    |
    |V:\...\TCC>global %x echo %_cwd
    |
    |GLOBAL: V:\bin\totalcmd\util\TCC
    |TCC: Unknown command "/Q"
    |
    |V:\...\TCC>global /Q echo %_cwd
    |V:\bin\TCC
    |---------
     
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    From: Stefano Piccardi
    | It appears that the parser doesn't like when it finds a variable
    | between GLOBAL and its command (in batch files and command lines):
    |
    | Code:
    | V:\...\TCC>ver
    |
    | TCC 13.00.27 Windows XP [Version 5.1.2600]
    |
    | V:\...\TCC>set x=/Q
    |
    | V:\...\TCC>global %x echo %_cwd
    |
    | GLOBAL: V:\bin\totalcmd\util\TCC
    | TCC: Unknown command "/Q"
    |
    | V:\...\TCC>global /Q echo %_cwd V:\bin\TCC

    Verified. This artifact of parsing has existed even in V7...

    This does not work either: set x to either GLOBAL or GLOBAL/Q as needed, and use %x as the global command. Also fails: alias g=`global %x`.

    Suggest you use an alias with its value set to either GLOBAL or to GLOBAL /Q as needed; which does work.
    --
    HTH, Steve
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,021
    Likes Received:
    84
    WAD. The parser won't expand variables in GLOBAL, because that would break
    variable expansion in the command itself.
     

Share This Page