how to get the full printer name/path for printing

  • Thread starter Thread starter Mullin Yu
  • Start date Start date
M

Mullin Yu

i can print a document at the dos prompt by the following command i.e.

c:\>copy test.doc <full printer path> eg.

c:\>copy test.doc \\sol\HPLJ4050TN

but, how can i determine that full path at program?

thanks!
 
Mullin,

In this case, I would do a query, using the classes in the
System.Management namespace, for all instances of Win32_Printer. Once you
have that, you can get the ServerName property to get the name of the
printer as it is on the network. You have to be careful though, as not all
printers are exposed like this, or there are other print services that turn
up using this method. If the ServerName is null, then don't use it, it's a
local printer driver, or local printer.

Hope this helps.
 
Back
Top