2014-08-27 49 views
0

事情是:我有两个简单的程序(同一软件的x86和x64版本),我从互联网下载。我想为他们创建一个CD安装程序。如何创建一个简单的安装程序调用程序

我只需要一个小而简单的程序,从软件文件夹“调用”setup.exe。一个带有两个按钮的简单窗口:“安装x86版本”和“安装x64版本”。比我可以点击其中一个按钮,程序会从右边的文件夹调用setup.exe,然后关闭它自己。

这样我就可以有这样的结构,我的CD内页:

./setup.exe 
./x64/setup.exe 
./x86/setup.exe 

事情是,我不知道如何写这个简单的软件。我有Python的知识,但要安装一个完整的Python解释器只是打开一个两个按钮的小窗口是相当矫枉过正。

是否有一个简单的脚本(在VB中,我猜)可以为我做这个?我在curses for linux中写了这样的东西,但我不是Windows高级用户。

非常感谢!

回答

2

在Visual Studio Express中创建一个新的WinForms应用程序并拖动窗体上的两个按钮。按你喜欢的设计。双击每个按钮以编辑.Click事件。

的方法来启动一个新的Windows进程Process.Start()

Private Sub Button1_Click(sender as Object, e as EventArgs) Handles Button1.Click 
    RunAndClose(IO.Path.Combine(Application.StartupPath, "x86", "setup.exe")) 
End Sub 
Private Sub Button2_Click(sender as Object, e as EventArgs) Handles Button2.Click 
    RunAndClose(IO.Path.Combine(Application.StartupPath, "x64", "setup.exe")) 
End Sub 

Private Sub RunAndClose(filename As String) 
    If IO.File.Exists(filename) = False Then 
    MessageBox.Show(String.Format("The selected installer {0}{0}{1}{0}{0} could not be found!", vbCrLf, filename), "Installer not found", MessageBoxButtons.OK, MessageBoxIcon.Error) 
    Else 
    Process.Start(filename) 
    Me.Close 
    End If 
End Sub 

您创建一个子RunAndClose实际做的工作。您有文件名作为子参数。检查您要启动的文件是否存在(IO.File.Exists)。如果是这样,启动它并关闭应用程序,如果不显示错误消息。

Button-Subs使用IO.Path.Combine函数。你提供了几个零件,并从中建立了一条路径。你想用它来代替手工建立字符串。

相关问题