Local printing question

  • Thread starter Thread starter Deyan Stoykov
  • Start date Start date
D

Deyan Stoykov

Hi everyone!
I want to configure an application running on win2000 terminal
server to send directly printer-ready files to a printer, attached to
the client machine. The printer is created on the server, but its name
is different every time the user logs in. I want to configure the app to
determine automatically the correct printer name to avoid users having
to select it manually from the select printer dialog. The first part of
the server-side printer name is always the same - the client-side
printer name. I can use the %CLIENTNAME% variable to replace the second
part with the client machine's name, but how can I obtain the session
number (environment variable, utility, etc.) and pass it to the application?
Thanks
 
I don't have a Windows 2000 machine in front of me, but
you should be able to get the current user's session
number by issuing this command at a command prompt:

for /f "tokens=3 skip=1" %i in ('qwinsta %username%') do
set SessionNum=%i

Hope this helps.

-M
 
Back
Top