running wzunzip in vb

Posted on 2004-11-08
Last Modified: 2010-12-24
How can I run the wzunzip add on within a vb program.  I use the shell command and I can get the help to come up, but if I add parameters then it just blows by it without doing anything.  This is what I tested so far  Shell "C:\Program Files\WinZip\wzunzip".  From a command prompt the it would look like this.

wzunzip c:\program files\unzip\ c:\program files\unzip\unziptest

Question by:mgmhicks
    LVL 28

    Expert Comment

    Does this work?

    Private Sub Command1_Click()
    Shell Environ("ComSpec") & " /c wzunzip c:\program files\unzip\ c:\program files\unzip\unziptest"

    End Sub

    Author Comment

    Sorry no go.  Just runs right through the shell command.

    if I use

    Shell "C:\Program Files\WinZip\wzunzip "

    i get the help screen like it took wzunzip, with no parameters, however if I try and add parameters it just runs right through it.

    LVL 85

    Accepted Solution

    It probably needs quotes around the path names (This is untested since I don't have wzunzip):

    Private Sub Command1_Click()
        Dim cmdLine As String
        cmdLine = Chr(34) & "C:\Program Files\WinZip\wzunzip" & Chr(34) & " " & Chr(34) & "c:\program files\unzip\" & Chr(34) & " " & Chr(34) & "c:\program files\unzip\unziptest" & Chr(34)
        Shell cmdLine
    End Sub

    LVL 69

    Expert Comment

    by:Éric Moreau

    Expert Comment

    The Accepted Solution above does not work for me

    Shell "C:\Program Files\WinZip\WZUNZIP.EXE" "\\SERVER\Users\Geoff\"

    does not work in The WZUNZIP.EXE command help/reference screen opens.

    When I paste the same command in the Windows 7 Start-Run dialog box, It runs fine.

    "C:\Program Files\WinZip\WZUNZIP.EXE" "\\SERVER\Users\Geoff\" in windows run works.

    Expert Comment

    Never mind - I changed My code from:

    """" & Cmd & """"

    Chr(34) & cmd & Chr(34)

    it works now. I really dont know why it did not work. The """" code works on an XP machine. But I will not arque with success.
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    For VB.Net, try something like this:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim File As String = "C:\Program Files\WinZip\WZUNZIP.EXE"
            Dim Arg As String = "\\SERVER\Users\Geoff\"
            Dim P As New Process
            P.StartInfo.FileName = File
            P.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(File)
            P.StartInfo.Arguments = Chr(34) & Arg & Chr(34)
        End Sub

    Open in new window


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now