Welcome!

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

SignUp Now!

Documentation About pseudovariables

Sep
134
1
Until Version 16 this decsision was a correct term:
SETLOCAL
Echo Status:%status%:
Set Status=Great
Echo :::::::::::::::::::::::::::::::::::::::::::::
Echo Status:%Status%:
:
IFF %Status%==great THEN
Echo JPSoft is good :-)
ELSE
Echo JPSoft is :-((
ENDIFF

ENDLOCAL

SInce the "%=" was "deprecated" (I never tested Version 17), it seems, that I must rewrite all my scripts, which has this form of decision. I have use this form, because it was for clear and "undoubted" for me.


PS: Ok,ok,ok ---- there is no big deal to edit these 7 texts, but it took a long time until I discovered this erroneous decision.
 
It works better with IF (and not with @IF).
Code:
v:\> type status.btm
SETLOCAL
Echo Status:%status%:
Set Status=Great
Echo :::::::::::::::::::::::::::::::::::::::::::::
Echo Status:%Status%:
:
IFF %Status%==great THEN
Echo JPSoft is good
ELSE
Echo JPSoft is not so good
ENDIFF

IF %Status%==great (Echo JPSoft is good) ELSE (Echo JPSoft is not so good)

ECHO JPSoft is %@IF[%Status%==great,good,not so good]

ENDLOCAL
v:\> status.btm
Status::
:::::::::::::::::::::::::::::::::::::::::::::
Status:Great:
JPSoft is not so good
JPSoft is good
JPSoft is not so good
 
In fact, your construction, Peter, seems OK in v16. And, the results differ in 16, 17, and 18. The only construction that gets it right in all three versions is the one that uses IF.
Code:
v:\> type status.btm & do i=16 to 18 (echo. & g:\tc%i\tcc.exe /c status.btm)
Echo %_4ver
Set Status=Great
IFF %Status%==great THEN
Echo JPSoft is good :-)
ELSE
Echo JPSoft is not so good :-((
ENDIFF

IF %Status%==great (Echo JPSoft is good) ELSE (Echo JPSoft is not so good)

ECHO JPSoft is %@IF[%Status%==great,good,not so good]

16.03
JPSoft is good :-)
JPSoft is good
JPSoft is not so good

17.00
JPSoft is good :-)
JPSoft is good
JPSoft is good

18.00
JPSoft is not so good :-((
JPSoft is good
JPSoft is not so good
 
In fact, your construction, Peter, seems OK in v16. And, the results differ in 16, 17, and 18. The only construction that gets it right in all three versions is the one that uses IF.
Code:
v:\> type status.btm & do i=16 to 18 (echo. & g:\tc%i\tcc.exe /c status.btm)
Echo %_4ver
Set Status=Great
IFF %Status%==great THEN
Echo JPSoft is good :-)
ELSE
Echo JPSoft is not so good :-((
ENDIFF

IF %Status%==great (Echo JPSoft is good) ELSE (Echo JPSoft is not so good)

ECHO JPSoft is %@IF[%Status%==great,good,not so good]

16.03
JPSoft is good :-)
JPSoft is good
JPSoft is not so good

17.00
JPSoft is good :-)
JPSoft is good
JPSoft is good

18.00
JPSoft is not so good :-((
JPSoft is good
JPSoft is not so good

Many thanks, Vince, for your basic research :-)
I have also been through the game, because the query includes other processes, for example,

Code:
IF %direction%==VON .AND. %Compi%==HOME MsgBox YesNo "Datenabgleich mit Netz ? " "dann ..."
If Copydirection "FROM" AND Computer = HOME ask for data synchronization with Network


So I've chosen the easier way , I'm using spaces or the operator keywords:

Code:
IF %direction% == FROM .AND. %Compi% == HOME MsgBox YesNo "Datenabgleich mit Netz ? " "dann ..."
 ........

IF %direction% EQ AUF .AND. %Compi% EQ JOB MsgBox YesNo "Datenabgleich mit %userdir ? " "dann ..."

I don't like the If-Version, because it Comes to Trouble, if I will use parenthesis:
Code:
IF %Status%==great (
  Echo JPSoft is good
) ELSE (
   Echo JPSoft is not so good :-((
)

so I prefer the IFF-Statement ....

The main reason for the use of %direction%==VON was avoiding spaces in the variable name and variable Content (because this could be/was a Problem in the past days of Batch programming ...).



 
OPTION / Advanced / Special Characters - uncheck "Expand Pseudovariables".

Problem solved.

Yes, it is, but that immediately brings me another "Problem" : After I do the uncheck, I have to check all my BTM-Scripts on pseudovariables :arghh: because I've use it in the past ....

Never mind, it's time to make a cleaning step :joyful:
 
And that's why we officially deprecated pseudovariables two years ago. (They've been functionally obsolete for at least 13 years.)

Your syntax is forcing TCC to guess whether you want %= interpreted as a pseudovariable -- sometimes you do, and sometimes you don't. And when you do, you want to break CMD compatibility (as in "%var"==...)
 
Back
Top