Re: multi-line command output to single Var?
- From: Mark V <notvalid@xxxxxxxxxxx>
- Date: Fri, 16 Feb 2007 15:04:25 -0500
In microsoft.public.win2000.cmdprompt.admin, Matthias Tacke wrote:
foxidrive wrote:
Untested:
"%comspec%" /V:ON /c for /f "Tokens=1 Delims=:" %a in
('subst.exe') DO SET ANS=!ANS!%a
Hello foxidrive,
I've had that same idea, but vars in the new cmd will be lost
upon return.
Maybe the trick with set /p =%a will do: (all on one line)
"%comspec%"
/V:ON /c for /f "Delims=:" %a in ('subst.exe') DO @echo/^|set /p
=%a
From CMD with /V:ON and running the FOR part I see output:|set /p=U
|set /p=X
|set /p=Y
|set /p=Z
(which would not have helped the perceived problem)
I don't now autoit but there should be a better solution.
There is. Incomplete documentation tripped this AU3 newbie up by
way of failing to mention that the RUN() function can push "lines"
of output onto a (unmentioned) hidden internal queue/stack.
StdOutRead() called in a loop can pop the FIFO lines and recover
all the original command's STDOUT.
In hindsight it all make perfect sense of course! LOL
@MarkV AFAIK the for loop works also with (hidden) intermediate
files.
Like the use of "invisible" pipes in some commands? Interesting.
Thanks guys for the ideas! Hope it was amusing at least. ;)
.
- Follow-Ups:
- Re: multi-line command output to single Var?
- From: Matthias Tacke
- Re: multi-line command output to single Var?
- References:
- multi-line command output to single Var?
- From: Mark V
- Re: multi-line command output to single Var?
- From: foxidrive
- Re: multi-line command output to single Var?
- From: Matthias Tacke
- multi-line command output to single Var?
- Prev by Date: Re: multi-line command output to single Var?
- Next by Date: Re: multi-line command output to single Var?
- Previous by thread: Re: multi-line command output to single Var?
- Next by thread: Re: multi-line command output to single Var?
- Index(es):
Loading