Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Alternatives to the (obsolete) @execstr function

Aug
1,929
71
In reference to this post here are some alternatives to the (obsolete) @execstr function;

Code:
echo Yes^NNo |! echo %@line[con,1] |! set /p results=

echo %results
No

Code:
type "%_ininame" |! echo %@line[con,10] |! set /p results=

echo %results
BeepLength=2

Code:
tasklist.exe |! echo %@line[con,4] |! set /p results=

echo %results
System                           4 Services                   0        428 K

Code:
pshell /s "$X = tasklist.exe | select -index 4" && echo %@pshell[$X]
System                           4 Services                   0        464 K

Joe
 
echo Yes^NNo |! echo %@line[con,1] |! set /p results=
echo %results
No

The help is not very keen on SET /P. You could also

Code:
echo Yes^NNo |! echo %@line[con,1] |! input %%results


echo %results
No

But I don't think of @EXECSTR as obsolete? Compared to the above, it seems like an innovation. It seems to do a better job of hiding ugly details and it's more readable.

Both amount to the same thing ... put the text in a temp file and set results to the second line of that file.
 
I agree Vince, but since Rex says @EXECSTR is obsolete, I thought it best to start looking at ways to replace it.

Joe
 
Back
Top