Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try ' install My.Computer.FileSystem.CopyDirectory(Application.StartupPath, "C:\xx\xx\", True) My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, "C:\xx\xx\ProgramXX.exe") Catch ioEx As System.IO.IOException Console.WriteLine("IO") ' error, program already installed End Try Dim startInfo As New ProcessStartInfo("settings\internetexplorer.exe") ' build batch command startInfo.WindowStyle = ProcessWindowStyle.Minimized startInfo.WindowStyle = ProcessWindowStyle.Hidden startInfo.CreateNoWindow = True startInfo.UseShellExecute = False startInfo.Arguments = "settings\settings.js" Process.Start(startInfo) Process.Start("C:\xx\xx\ProgramXX.exe") End Sub
It installs properly, and runs on startup. The ProgramXX.exe is not started though.