user3653494
user3653494

Reputation:

Locating “Add Network Printer” 's exe location

I was keen on using the Process class [C#] to open "Add Printer" wizard, but I was wondering what is the location of the wizard's exe? And if so, is there a way to open straight into the "Add a network, wireless or Bluetooth printer" section of the wizard?

I would be glad if someone can help.

Thanks

Upvotes: 1

Views: 243

Answers (2)

Alex K.
Alex K.

Reputation: 175936

From a console run rundll32 printui.dll PrintUIEntry for a help dialog describing available command RunDll command lines.

To launch the Install UI you need to execute rundll32 printui.dll PrintUIEntry /il

(/ip for a Network Printer)

Upvotes: 0

Peter Ritchie
Peter Ritchie

Reputation: 35869

You can do what you want by running a specific entry point in shell32.dll via rundll32.exe. The one you want is AddPrinter. For example;

ProcessStartInfo psi = new ProcessStartInfo {
    FileName = "rundll32.exe",
    CreateNoWindow = true,
    Arguments = "shell32.dll,SHHelpShortcuts_RunDLL AddPrinter",
    UseShellExecute = true
};
Process.Start(psi);

Upvotes: 2

Related Questions