I want to create a batch file that can perform a print test page on execute. Problem is that I can't use code which I already have for any printer as far as it is set as default.
I have the following code which can run print test page command, but it only works if you will type in it name of the default printer.
rundll32 printui.dll,PrintUIEntry /k /n"Adobe PDF"
I was wondering if there is some sort of solution to connect the following two codes with if-else statements.
This code can print a test page -
rundll32 printui.dll,PrintUIEntry /k /n"Adobe PDF"
This code can check default printer -
wmic printer get name,default
Is there a way to create a batch file that can set the default printer name as a variable and use this variable in the second code to execute a print test page on the default printer all the time?
I did manage to do it with the following batch file:
RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "%printer_name%"
start /min notepad /P "\\fs\FIle Share\SA Support\ZverTools\printtestpage.txt"