Bat file coding
hi guys, anyone know how to check for a printer on usb then set it as default, must be BAT format tho sadly because i want it to fit in to my current script. we currently map and default network printers like this: IF %Location% == itsuite \\Domain\netlogon\CON2PRT /CD \\Domain\suite
using a enivronment variable to set locations.
could you not write the code in .vbs and write a line in your .bat file to call the .vbs?
if you could tell me how to call a vbs from a bat then yea i suppose
think it will be easier to do it in .vbs than a .bat file? think you would have to install extras to acheive this from a .bat script.
Set shell= WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to oPrinters.Count - 1 Step 2
if oPrinters.Item(i) = "LPT1:" then
elseif oPrinters.Item(i) = "USB001" then
then called in the bat, o that was easier than i thought! cheers
yh, i was looking for the code to send you, on easter hols for 2 weeks so couldnt get hold of it...
try this website Logon Script Printer - AddWindowsPrinterConnection VBScript Method is quite good for things like this...