• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

DOS question

XTC

Fingers like lightning
Joined
Apr 13, 2007
Messages
611
Likes received
0
Thanks received
0
I want to send printer paths i.e \\servername\printername to a text file. i can do this for drive mapping i.e net use > c:\mappings.txt can I do this for printers?
 
Use this script

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)

Save to a text file e.g. ptrt.vbs then run

cscript prt.vbs >ptr.txt
 
xondo said:
Use this script

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)

Save to a text file e.g. ptrt.vbs then run

cscript prt.vbs >ptr.txt

Great thanks mate.
 

Advertisers

Back
Top