My Batch Script not working for adding printer

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
netninja101
Posts: 1
Joined: 15 Jun 2023 02:24

My Batch Script not working for adding printer

#1 Post by netninja101 » 15 Jun 2023 18:09

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.

Post Reply