Windows Perl (icon v command line)

drkjam drkjam at
Mon Dec 12 10:24:45 GMT 2005

>The 'SESSIONNAME' variable looked promising for a second (it says 
>"Console" on my local box, leading me to think that it would distinguish 
>between command and GUI), but on an RDP session it is set to "RDP-Tcp#18" 
>which isn't that helpful to you.
A bit of trivia about the SESSIONNAME variable. It is related to the use
of Terminal Services in versions of Windows since 2000. A value of
'Console' means that your executable was started by the logon session of
someone physically sitting in front of the machine logging in via the
physical keyboard and mouse (of which there is only one session
available). A session name of RDP-Tcp#x tells you that it is an
executable running inside the x'th instance of a Terminal Server
(remote) session in this case running using RDP protocol over TCP/IP.

NB - Windows XP also has limited support for Terminal Service
connections built into it (via Remote Assistance). This is limited to
one remote connection only with mutually exclusive use over the local
login. Basically if someone is logged in remotely the local screen is
locked. As soon as you unlock it, you kick off the person using the
remote session. The SESSIONNAME variable will have a value of RDP-Tcp#1
for the remote session.

David Moss

More information about the mailing list