Add and remove local printer and driver through the command line. Can be used in scripts or packages. Before adding the printer, setup port and restart the Print Spooler service.
You can use the special characters listed in the following table to pass multiple commands.
Character
Syntax
Definition
& […]
command1&command2
Use to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command.
&& […]
command1&&command2
Use to run the command following && only if the command preceding the symbol is successful. Cmd.exe runs the first command, and then runs the second command only if the first command completed successfully.
|| […]
command1||command2
Use to run the command following || only if the command preceding || fails. Cmd.exe runs the first command, and then runs the second command only if the first command did not complete successfully (receives an error code greater than zero).
( ) […]
(command1&command2)
Use to group or nest multiple commands.
; or ,
command1parameter1;parameter2
Use to separate command parameters.
Note: The ampersand (&), pipe (|), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments
Note: This method can also be used in a .MSI package, through a Custom Action