Welcome!

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

SignUp Now!

Determine if DIRENV is ON or OFF

Aug
1,943
71
Code:
     _x64: 1
   _admin: 1
_elevated: 1

TCC  32.00.14 x64   Windows 10 [Version 10.0.19045.4291]

I would like to determine if DIRENV is ON or OFF.

Seeing if DIRENV is on or off via the TCMD.INI file
only returns results if DIRENV is indeed in the TCMD.INI file,
which in mine,
it is not.

So, I am attempting to see what the DIRENV command returns.
Code:
E:\Utils>direnv 

E:\Utils>echo %@execstr[direnv] 
DIRENV is OFF

E:\Utils>echo %@word[0,%@execstr[direnv]] 
DIRENV

E:\Utils>echo %@word[1,%@execstr[direnv]] 
is

E:\Utils>echo %@word[2,%@execstr[direnv]]

0=DIRENV
1=is
2=


Why can I not retrieve the third word,
which should be OFF or ON?

Joe
 
Not an answer to the question which you asked, but... Have you tried %@option[direnv]?


P.S. Note that %@option[direnv] returns "Yes" or "No", not "On" or "Off".
 
And in answer to the question you did ask: After variable expansion, your command becomes either ECHO OFF or ECHO ON. These two words are handled specially by the ECHO command; see HELP ECHO for details.

To work around this ancient misfeature, use a period instead of a space to separate the command and its args:

Code:
echo.%@word[2,%@execstr[direnv]]
 
Thankyou @Charles Dye,
I will go with the @option solution.

I probably knew that at one time, but forgot about it.

Thankyou also for the solution using the period.

I should have known that also.

Joe
 

Similar threads

Back
Top