parsing issue in command GLOBAL

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
May 31, 2008
376
2
#1
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
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
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