Using @PSHELL from @EVAL

Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  26.00.29 x64   Windows 10 [Version 10.0.18362.719]

Code:
echo %@pshell[100+1]
returns 101, which is correct.

Code:
echo %@len[%@pshell[100+1]]
returns 5, instead of 3.

Code:
echo %@eval[%@pshell[100+1]]
returns
Code:
TCC: Syntax error "101
"

If I store the result in an environment variable;
Code:
set result=%@pshell[100+1]
and then;
Code:
echo %@eval[%result]
it returns 101, which is correct.

Why can I not use the @pshell function directly from @eval?

Joe
 
I came up with this;
Code:
function pshell64=`%@strip[%@char[13 10],%@pshell[%$]]`
which works.

However, I think I'll go with what @Charles Dye provided;
Code:
function pshell64=`%@rtrim["%@char[10 13]",%@pshell[%$]]`

Bummer that I have to use a user-defined @pshell64 function instead of @pshell, but as the PowerShell DLL is a third-party tool, this appears to be a workable solution.

Thanks from Joe
 

Similar threads