Page 1 of 1

My Batch Script not working for adding printer

Posted: 15 Jun 2023 18:09
by netninja101
Hi, I needed help with my batch script of adding the printer by ip. because it says argument is invalid.

Here are my codes:

@echo off

REM Prompt the user to enter the IP address of the printer
set /p ipaddress=Enter the IP address of the printer:

REM Add printer using TCP/IP device with the specified IP address
wmic printer addport %IP_ipaddress% "IP_Standard" /persistent:yes

REM Change the path to the actual directory where the printer driver is located
set driverPath=C:\Users\computername\Downloads\printerdriver\z98783L1b\disk1\oemsetup.inf

REM Install the printer driver from the specified driver path
rundll32 printui.dll,PrintUIEntry /if /b "printername" /c %ipaddress% /m "PCL6 UniversalDriver V4.36" /f "%driverPath%\driver.inf"

echo Printer installation completed.