Dean,
I used your batch file in a test. It turns out that when
the batch file retrieves the default printer information
from the registry, it returns a value like:
\\\\servername\\printername
So, using regedit, I did an export on the registry key,
and I get the same value, \\\\servername\\printername,
even though the correct format, \\servername\printername,
is listed as the registry value when using regedit.
Since I know the servername will be the same for all the
printers, I was able to get around it by adding the
following to your batch file:
set DEFAULTPRINTER=%DEFAULTPRINTER:~13%
This truncated the 1st 13 characters, getting rid of all
the \'s.
Then I used:
net use lpt1: \\servername\%DEFAULTPRINTER% /persistent:yes
That appears to work on 2000 and XP.
Any ideas on how to get the correct default printer value
out of the registry, using your script?
Thanks again,
Mike
-----Original Message-----
Mike said:
Does anyone know if there a variable for the Default
Printer in Windows 2000? I tried %Default_Printer%, but
it does not work. I can't find a list of Windows 2000
variables anywhere.
Thanks,
Mike
I know of no environment variable that is pre-populated with that
information. The enclosed text file is a shell script (batch file) that
will set the environment variable DEFAULTPRINTER to the name of the
current user's default printer.
HTH
Dean
--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l