Batch scripts are Windows command line files that execute due to the ".BAT" file extension. Batch files are commonly used by network administrators to automate the process of making printers available to network users. To add a printer, only two lines of code are needed in a batch file, which are written using the free text editor included with the Windows operating system.
- Skill level:
Other People Are Reading
Click the Windows "Start" button. Type "notepad" into the search text box on the pop-up menu. Press "Enter" to open Notepad.
Type the following code for the first batch file line:
rundll32 printui.dll,PrintUIEntry /ia /c\server /m "AGFA-AccuSet v52.3" /h "Intel" /v "Windows 7" /f %windir%\inf\ntprint.inf
Replace "server" with the name of the computer that has the Windows print drivers. This can be the local computer or a network server. "AGFA-AccuSet v52.3" represents the driver name. Replace "Intel" with the name of your server.
Add the following line into the text editor, which connects the printer to a port on the computer:
rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /c\SERVER /f "%windir%\inf\ntprint.inf" /r "lpt1:" /m "AGFA-AccuSet v52.3"
This line is similar to the line of code in Step 2, but this line adds the printer to "lpt1." Replace this command with the port. If there is only one printer installed on the computer, then "lpt1" works for the local computer settings. Like the line of code in Step 2, replace "server" with your server name, and "AGFA-AccuSet v52.3" is your printer driver name.
Click the Notepad "File" menu item and select "Save As." Select "All Files" from the "File type" drop-down box. Type "addprinter.bat" for the file name. Click "Save."
Test your new file by double-clicking it on your computer. The batch file executes and adds the printer to your computer.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for