5

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
  • 53
  • 1
  • 3

2 Answers2

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
  • 6,767
  • 2
  • 18
  • 20
  • This is **not** an answer to the original question - **The problem is creating the .inf file** – DavidPostill Sep 30 '14 at 04:32
  • 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 Sep 30 '14 at 17:32
  • @fsobral Updated. – STTR Oct 01 '14 at 04:03
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.

clhy
  • 6,283
  • 8
  • 34
  • 66
user1454265
  • 171
  • 1
  • 6