Windows Thread, Bat file coding in Technical; hi guys, anyone know how to check for a printer on usb then set it as default, must be BAT ...
31st March 2010, 12:14 PM #1
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.
IDG Tech News
31st March 2010, 12:17 PM #2
could you not write the code in .vbs and write a line in your .bat file to call the .vbs?
31st March 2010, 12:34 PM #3
if you could tell me how to call a vbs from a bat then yea i suppose
31st March 2010, 12:37 PM #4
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.
Thanks to neon from:
tommccann (31st March 2010)
31st March 2010, 12:40 PM #5
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
31st March 2010, 12:41 PM #6
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...
By ful56_uk in forum MIS Systems
Last Post: 24th April 2010, 09:53 PM
By T_Noble in forum Coding
Last Post: 20th January 2010, 01:03 PM
By Danny159 in forum Windows Vista
Last Post: 14th March 2009, 02:54 PM
By ful56_uk in forum Windows
Last Post: 7th April 2008, 01:09 AM
By russdev in forum Web Development
Last Post: 11th November 2006, 11:49 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)