将字符串插入另一个程序?

时间:2011-02-14 16:28:46

标签: vb.net

我有一个程序从ListView控件运行检查项。这些项是自解压ZIP .EXE文件。不幸的是,我希望它们加密,并且看起来WinZip似乎不允许您将密码作为参数传递。这意味着,用户必须一遍又一遍地输入密码(它们对于所有.EXE文件都是相同的)。

Try
    If Not String.IsNullOrEmpty(TextBox1.Text) Then

        If Directory.Exists(TextBox1.Text) Then
            ' Process.Start(tmpWhatRun, "/auto " & TextBox1.Text)


            Dim startInfo As System.Diagnostics.ProcessStartInfo
            Dim pStart As New System.Diagnostics.Process

            startInfo = New System.Diagnostics.ProcessStartInfo(tmpWhatRun, _
               "/auto " & TextBox1.Text)
            pStart.StartInfo = startInfo
            pStart.Start()
            pStart.WaitForExit()

        Else : MsgBox("Invalid directory.")
        End If

    Else
        Dim startInfo As System.Diagnostics.ProcessStartInfo
        Dim pStart As New System.Diagnostics.Process

        startInfo = New System.Diagnostics.ProcessStartInfo(tmpWhatRun)
        pStart.StartInfo = startInfo
        pStart.Start()
        pStart.WaitForExit()     
    End If
Catch ex As Exception
End Try

我已经看到了一些关于使用Windows API的东西,但这似乎可能会导致一些问题,因为这些是我的程序所不具备的外部程序。

2 个答案:

答案 0 :(得分:2)

尝试使用7zip或zlib来提取你的exe。 他们附带.Net示例

答案 1 :(得分:0)

Jai,如果您真的想使用它,可以使用WinZip的命令行扩展,或者您可以尝试使用WinRar执行相同的操作。

相关问题