How to install a dummy printer by command?

3

i need to install a fake/dummy printer on windows using a command or a batch file.

I was able to install a dummy printer using the wizard and selecting a NUL port. The problem is that i need to add the dummy printer automatically, so the wizard is not an option.

In my search for a solution i found that it is possible to execute the rundll32 printui.dll PrintUIEntry command with the /il parameter to install a printer using a .inf file.

The problem is creating the .inf file. I read some documentation and tutorials but i still have no idea what this file must contain. Any ideas with this?

Also I'm not sure if the rundll32 printui.dll PrintUIEntry command with a custom .inf file is the right answer, so i'm listening.

fsobral

Posted 2014-09-29T21:29:57.083

Reputation: 33

Answers

2

rundll32 printui.dll,PrintUIEntry /if /b "NUL Printer" /f "%systemroot%\inf\ntprint.inf" /r "nul:" /m "HP DesignJet 755CM/PS" /z

Update 1:

Postscript printer Name XP/2003:

findstr /S ModelName %windir%\*.ppd
findstr /S ModelName %windir%\system32\spool\drivers\*.ppd
findstr /S ModelName %windir%\SysWOW64\*.ppd

Unpack driver.cab! Postscript printer name XP/2003:

findstr /S ModelName "%windir%\Driver Cache\amd64\driver\*.ppd" | more
@for /f "tokens=1,2,3,4 delims=:" %a in ('findstr /S ModelName "%windir%\Driver Cache\amd64\driver\*.ppd"') do @echo %d >>c:\prname.txt

inf:

findstr /S Class\=Printer %windir%\system32\DRVSTORE\*.inf
findstr /S Class\=Printer %windir%\inf\*.inf

Search printer name at xml and ini-files too.

Set port FILE: and print *.ps file. Convert .ps -> .pdf or view print page in PS Viewer.

I install HP Designjet Z6200ps 60in PS3 printer driver to print large page to pdf (ps->pdf).

Max MS Office page size - 558,7x558,7 mm.

Printer INF Files

See too MSDN Library offline (ISO CD to Visual Studio), DDK, WDK, TechNet.

STTR

Posted 2014-09-29T21:29:57.083

Reputation: 6 180

This is not an answer to the original question - The problem is creating the .inf file – DavidPostill – 2014-09-30T04:32:41.010

This actually worked, the only thing i had to change was the printer driver because i'm using windows 8 and kept getting error 0x00000705. rundll32 printui.dll,PrintUIEntry /if /b "NUL Printer" /f "%systemroot%\inf\ntprint.inf" /r "nul:" /m "Microsoft PS Class Driver" /z. Now i'm wondering if there is a printer driver that already comes in windows xp/7/8 – fsobral – 2014-09-30T17:32:17.173

@fsobral Updated. – STTR – 2014-10-01T04:03:30.723

0

I had trouble getting the accepted solution working on multiple versions of Windows, due to the drivers present.

The "Generic / Text Only" driver is present in all my target OS's (Win7 Embedded and Win8.1), so this modification worked for me:

rundll32 printui.dll,PrintUIEntry /if /b "Null Printer" /f "%systemroot%\inf\ntprint.inf" /r "nul:" /m "Generic / Text Only" /z

Use $ENV:systemroot instead of %systemroot% if calling from PowerShell.

user1454265

Posted 2014-09-29T21:29:57.083

Reputation: 161