Checking for env. var.

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

I need to test for a terminal server connection. If someone is connecting to
a terminal server then I need to do something. The variable is:

sessionname=xxxxx


How can I test for sesssion name regardless of what is to the right of the =
sign? If there is any sessionname environment variable do something?

Tia...
 
Larry said:
I need to test for a terminal server connection. If someone is connecting to
a terminal server then I need to do something. The variable is:

sessionname=xxxxx


How can I test for sesssion name regardless of what is to the right of the =
sign? If there is any sessionname environment variable do something?

Tia...
if defined sessionname ..... ?

see if /?

HTH
 
Matthias Tacke said:
if defined sessionname ..... ?

That won't work. SESSIONAME will normally be Console vs. something like
SESSIONNAME=RDP-Tcp#12 for a ts session.

So...
if not "%SESSIONNAME%"=="Console" (
:: do stuff
)
 
Paul, that is what I was looking for, I needed the reverse of what I was
trying to do...

Thx, Larry
 
Paul R. Sadowski said:
That won't work. SESSIONAME will normally be Console vs. something like
SESSIONNAME=RDP-Tcp#12 for a ts session.

So...
if not "%SESSIONNAME%"=="Console" (
:: do stuff
)
Thanks for your better tip,
in lack of a TS and based on OP's assumptions my tip fell short :-)
 
Your tip was exactly right. if /? is the answer. It's the answer given by the Paul the Sodomite as well, who is a total idiot, as he says use If but says you are wrong for using If.
 
Back
Top