![]() |
|
|
|
|
|||||||
| Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| inconsistent ls command display at the command prompt & running as a cron job | rajranibl | Linux | 5 | 07-30-2007 05:26 AM |
| user prompt doesn't pop up with rsh command | ronenalalush | UNIX for Advanced & Expert Users | 1 | 02-13-2007 02:45 AM |
| Display Printers via command line | gseyforth | Windows & DOS: Issues & Discussions | 3 | 06-27-2006 10:02 PM |
| Command prompt from within a script? | sanitywonko | Shell Programming and Scripting | 1 | 04-25-2005 12:11 PM |
| any way to use SU command without prompt for password | myelvis | Shell Programming and Scripting | 7 | 11-17-2003 04:27 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Finding printers from a command prompt
Does anyone know how I can find printers from a dos prompt?
I'm trying to create a batch file which cats the printers and their locations to another file which I will use later in the script. Maybe windows has a file from which I may read in this information? Thanks! |
| Forum Sponsor | ||
|
|
|
|||
|
Very clunky, but:
for /f %i in ('net view') do net view %i | find "Print" >>result.txt Explanation: 'net view' - command to display all sharing-enabled computers in a workgroup or domain. 'for /f %i ...' - for each line of result (%i) from 'net view', list the shares on that computer. '| find "Print" - Pipe the preceding output through FIND.COM and look for the string "Print", indcating a shared printer. '>>result.txt' - append the output to the file "result.txt", NOTE: >> to append, not > to write to or we'll only see the last positive match in our file. The resulting file (result.txt in this case) will look something like: [Netbios name, Service, Comment] AC_PRN Print Accounts department multifunction PR_DESJ Print Public Relations department Colour Deskjet SH_DMP Print Shipping office dot-matrix label printer Hope it helps. If you want anything better I think you're going to have to look at some VB scripting and active directory-based looking-up. Last edited by jallport; 03-28-2006 at 05:29 AM. |
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|