"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 "^.[^=]="
It is documented that when SET is used to display currently defined environment variables, the only wildcard available is * - but why?
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
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
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
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
|
"Missing SETLOCAL" when initializing Visual Studio Command Prompt. | Support | 9 | |
![]() |
Changes to Keyboard Settings Not Being Saved | Support | 10 | |
![]() |
WSETTINGS WiFi | Support | 2 | |
S | SET /A question; HELP nits | Support | 8 | |
![]() |
@REGSETENV question | Support | 7 |