Local printing question

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
 
M

Matthew Harris [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top