locked
How to create a program to install software..o.0? RRS feed

  • Question

  • Hi guys, is there a way to create a program that installs multiple software, per say a program with multiple software packages/installs that you can install. kinda like a tool kit.

     

    Thanks in advance ;)

    Tuesday, June 14, 2011 9:26 AM

Answers

  • Hello crafter,
     
    Thanks for your post.
     
    Please check this article which about how to install and uninstall *.msi files.
      
    http://www.codeproject.com/KB/cs/C____MSIEXEC.aspx (C# - Installing and uninstalling software)
     
    It is in C#. You could make a convertion by http://www.developerfusion.com/tools/convert/csharp-to-vb/

    The code to install software without user interface is: 

    Private Sub installSoftware()
    
    	Dim p As New Process()
    
    	p.StartInfo.FileName = "msiexec.exe"
    
    	p.StartInfo.Arguments = "/i ""C:\Application.msi""/qn"
    
    	p.Start()
    
    End Sub
    
    
     
    When you installs multiple software, you could put the multiple software installing files to a certain directory. Use Directory.GetFiles Method to read file names in the directory. Then assign the file name to the p.StartInfo.FileName using loop. Here is an example about opening all the files under D:\12. You could make a convertion according to your scenario.
     
    Imports System.IO
    
    Public Class Form1
      Dim i As Integer
      Dim setupFiles As List(Of String) = ReadingFiles("D:\12")
    
      Public Shared Function ReadingFiles(ByVal path As String) As List(Of String)
        Dim listFiles As New List(Of String)()
    
        'get files from the directory
        Dim currentFiles As String() = Directory.GetFiles(path, "*.*") 'you could change the file extend name according to your scenario
        For Each file As String In currentFiles
          listFiles.Add(file)
        Next
        Return listFiles
      End Function
    
      Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'code to install software
        Dim p As New Process()
        For i = 0 To setupFiles.Count - 1
          p.StartInfo.FileName = setupFiles.Item(i).ToString
          p.Start()
        Next
      End Sub
    
    End Class

    If you have any concerns, please feel free to follow up.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



     


    • Marked as answer by GeekzInside Monday, June 20, 2011 8:08 AM
    Wednesday, June 15, 2011 10:55 AM
  • Yes. Above example is a simple demo. You could modify according to your scenario. I found you have marked the answer. If you still have any questions about this issue, please feel free to follow up.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by GeekzInside Wednesday, September 24, 2014 8:53 PM
    Tuesday, June 21, 2011 6:07 AM

All replies

  • You should see Installer  Classes. This should do your work.
    Tuesday, June 14, 2011 2:16 PM
  • Do you want to install the softwares in Stealth mode you mean?
    Tuesday, June 14, 2011 3:54 PM
  • Hello crafter,
     
    Thanks for your post.
     
    Please check this article which about how to install and uninstall *.msi files.
      
    http://www.codeproject.com/KB/cs/C____MSIEXEC.aspx (C# - Installing and uninstalling software)
     
    It is in C#. You could make a convertion by http://www.developerfusion.com/tools/convert/csharp-to-vb/

    The code to install software without user interface is: 

    Private Sub installSoftware()
    
    	Dim p As New Process()
    
    	p.StartInfo.FileName = "msiexec.exe"
    
    	p.StartInfo.Arguments = "/i ""C:\Application.msi""/qn"
    
    	p.Start()
    
    End Sub
    
    
     
    When you installs multiple software, you could put the multiple software installing files to a certain directory. Use Directory.GetFiles Method to read file names in the directory. Then assign the file name to the p.StartInfo.FileName using loop. Here is an example about opening all the files under D:\12. You could make a convertion according to your scenario.
     
    Imports System.IO
    
    Public Class Form1
      Dim i As Integer
      Dim setupFiles As List(Of String) = ReadingFiles("D:\12")
    
      Public Shared Function ReadingFiles(ByVal path As String) As List(Of String)
        Dim listFiles As New List(Of String)()
    
        'get files from the directory
        Dim currentFiles As String() = Directory.GetFiles(path, "*.*") 'you could change the file extend name according to your scenario
        For Each file As String In currentFiles
          listFiles.Add(file)
        Next
        Return listFiles
      End Function
    
      Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'code to install software
        Dim p As New Process()
        For i = 0 To setupFiles.Count - 1
          p.StartInfo.FileName = setupFiles.Item(i).ToString
          p.Start()
        Next
      End Sub
    
    End Class

    If you have any concerns, please feel free to follow up.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.



     


    • Marked as answer by GeekzInside Monday, June 20, 2011 8:08 AM
    Wednesday, June 15, 2011 10:55 AM
  • Hi guys, thanks for the replies.

    -croudedthoughts: im not really familiar with Stealth mode,  what's the difference from Liliane Teng's suggestion?

    -Liliane Teng: what i want to create is an application that has a list of software that the user can select from and then click a button "Install" and the install starts. And also add an option to check the documentation and training material/Help for each specific software. Will those steps you provided help me accomplish this?

     

    Thanks again guys.

     

     

     

    Saturday, June 18, 2011 1:19 PM
  • Yes. Above example is a simple demo. You could modify according to your scenario. I found you have marked the answer. If you still have any questions about this issue, please feel free to follow up.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by GeekzInside Wednesday, September 24, 2014 8:53 PM
    Tuesday, June 21, 2011 6:07 AM