"I have a need to see the envvars whose names are exactly two characters long. Can I do that with SET alone?
@Echo Off
SetLocal
UnsetArray /Q EnvVars
SetArray EnvVars[64]
Echo >NUL: %@ExecArray[EnvVars,Set]
Set I=0
Do While %I LT %_ExecArray
If %@Len[%@Left[%@Index[%EnvVars[%I],=],%EnvVars[%I]]] == %@If["%1" == "", 2,%1] ^
@Echo %EnvVars[%I]
Set /A I+=1
EndDo
UnsetArray /Q EnvVars
EndLocal
Quit 0
set | grep "^.[^=]="
Because some people are crazy enough to use question marks, brackets, etc. in variable names?It is documented that when SET is used to display currently defined environment variables, the only wildcard available is * - but why?
Well, I was hoping to do it with FFIND. But it appears that FFIND always quits at the first match. (Is there any way to override that?)I no longer use "tools" like "grep" and the like....
Yeah! Why does it do that? Stopping after the first match is supposed to be an option (/F).Well, I was hoping to do it with FFIND. But it appears that FFIND always quits at the first match. (Is there any way to override that?)
e:\logs\mercury> set | ffind /e"^..=" /k /m
AE=3
e:\logs\mercury> set | do line in @CON ( if %@regex["^..=",%line] == 1 echo %line )
AE=3
AF=2
AL=3
(snip)
set | ffind /e"^.[^=]=" /v /k /m
It also stops after the first line when not in a pipe.Yeah! Why does FFIND do that? Stopping after the first match is supposed to be an option (/F).
e:\logs\mercury> ffind /e"." /m /k MERCURYS.LOG
T 20100601 033308 4bb58e47 Connection from 74.71.55.217
OK, that works. So what's "/F" all about?Hah!
Code:set | ffind /e"^.[^=]=" /v /k /m
(system) C:\...\TCCLE >set aa=1234
(system) C:\...\TCCLE >set bb=dfjsdfgjsdfg
(system) C:\...\TCCLE >set cc=****************
(system) C:\...\TCCLE >set | for %x in (@con:) (set i=%@index["%x",=] %+ if %i eq 3 echo %@word["=",0,%x])
aa
bb
cc
OS