1

I need to write code to download and run a program, e.g. notepad++ (npp.5.9.3.Installer.exe) this can be found on the web. I run it with the ProcessStartInfo class. However when I normally execute the notepad++ installer, it will show me a few steps before actually installing, like choose language, path etc.

Is there any way to programatically skip these steps, and install the software? I hope my question is clear. If it helps, I also attach the method that so far only starts the installer

        private int RunFile()
        {
            ProcessStartInfo psi = new ProcessStartInfo(GetFileFullPath());
            psi.WindowStyle = ProcessWindowStyle.Hidden;
            psi.CreateNoWindow = true;

            using (Process process = Process.Start(psi))
            {
                process.WaitForExit();
                if (process.HasExited)
                    return process.ExitCode;
            }
        }

Shall I pass some arguments for this to work? Thank you in advance.

Regards,

Amc_rtty
  • 3,662
  • 11
  • 48
  • 73

5 Answers5

4

Use npp.5.9.3.Installer.exe /S for unattended installation of notepad++, and %ProgramFiles%\Notepad++\uninstall.exe /S for uninstall.

CD..
  • 72,281
  • 25
  • 154
  • 163
2

There are some installers which supports -s or -silent switches which means that when you install a software by passing -s switch to installer and it will silently install with default options. Try to find out whether your installer supports that or not

Haris Hasan
  • 29,856
  • 10
  • 92
  • 122
  • For people looking also for an answer: this post has been noted as the answer, whereas _CD.._ post gives the actual answer. Check _CD.._ answer. – Otiel Jul 28 '11 at 08:56
  • i marked this post as the answer, since it was providing the info that I needed. CD gives specific for notepad++, but in my thread starting i mentioned that notepad is just an example (note the e.g. in my question); in short, I was looking for a more general answer. Also you provided both the general and specific answer, but Haris Hasan was faster :) – Amc_rtty Aug 05 '11 at 21:39
1

you have to drive the installation emulating the user. It is possible send kind of command(message) to the other window from a C# application

have a look at the below

http://social.msdn.microsoft.com/forums/en-US/winforms/thread/345d85e8-cc5f-4508-b3f2-74ee43521169/

Interact with other desktop-applications in windows using C# winforms

Community
  • 1
  • 1
Massimiliano Peluso
  • 26,379
  • 6
  • 61
  • 70
1

A wellwritten installer have options for silent installs with no user interface. If the installer is an .msi file there are options that can be passed to msiexec to make a silent install.

For other install systems there are sometimes options to. Automating installations without user involvement is a common task for system administrators, so if you have questions on a specific installation package I would suggerst asking at ServerFault or AppDeploy. Unfortunately there are many bad installation programs out there that doesn't support silent install.

Anders Abel
  • 67,989
  • 17
  • 150
  • 217
1

This will ONLY depend on the installer (npp.5.9.3.Installer.exe). You have to search if the installer provides options that can be used in command line, such as silentinstall.

EDIT: You can use the /S (capital S) option for Notepad++ to perform a silent install.

Otiel
  • 18,404
  • 16
  • 78
  • 126