self extracting exe

Posted on 2009-12-31
Last Modified: 2013-11-26

I am trying to automate a process and have been supplied self extracting exe's by a client.  The client will not supply anything else, so I am stuck with this route.

I am trying to find code to open and extract these files and place them into a directory of choice.

I've looked high and low and all the code that seems to be available via search engines involves creating self extracting exe's and not opening them.

Using 2008.

Any suggestions?

Thanks in advance!
Question by:pigface
    LVL 2

    Accepted Solution

    If it is self extracting Exe Can't you just do Process.Start

    Dim startInfo As New ProcessStartInfo("C:\bdw\Vault 2.0\packinglist.exe")
        startInfo.Arguments = "CalledfromMIDAS"
    LVL 10

    Expert Comment

    Depending on the type of self extracting exe you may have no choice but to let it extract itself. There is no requirement that these files conform to any established standards, only that they be a valid exe.
    LVL 2

    Expert Comment

    Just use Process.Start(Application path)
    LVL 1

    Expert Comment

    I agree with the others. Allow the programs to extract themselves. However, since you're automating a process, you'll need to wait until it ends and then continue on:

    Author Comment

    Hi Thanks for the feedback.  This is my 1st time to pick up on this thread since the new year.

    All seems logical, but how would I specify where the contents get unzipped?  On a self extracting exe, you can specify the destination folder and none of the examples show that.

    Thanks again for your help
    LVL 1

    Expert Comment


    It can be done, but it's not going to be easy. More than likely, what you'd have to do is utilize some Windows APIs and automate the pressing of buttons that way. But that's less than ideal.

    However, you can extract the contents of the self-extracting executable and do with them as you wish.

    In the past I've used UniExtractor. It has worked well for me in the past.


    If you don't want to go this route then I'll come up with a way to extract it.

    Author Comment

    Apologies for my delay, the UK has had lots of snow and I have been trapped in my very rural house away from work.

    I figured it out and I will assign points to Swapneel as he led me in the right direction.

    Here is the solution for what it is worth.  NB.  arguments and /auto play a big part in it running.  Also another stumbling block is that if you run this on a shared drive then you will get those annoying pop ups requesting "is it safe to run the exe blah blah blah"

    try this to cure that:

        Private Sub UnZipFile(ByVal ZipFile As String, ByVal DestFolder As String)

            Dim StartZip As New Diagnostics.Process

                StartZip.StartInfo.FileName = """" & ZipFile & """"
                StartZip.StartInfo.Arguments = " /auto " & """" & DestFolder & """"
                StartZip.StartInfo.WindowStyle = ProcessWindowStyle.Hidden


                Dts.TaskResult = Dts.Results.Success

            Catch ex As Exception
                Dts.TaskResult = Dts.Results.Failure

                StartZip = Nothing
            End Try

        End Sub

    I think I should assign some points to myself too :)

    Author Closing Comment

    only a partial answer hence B and I did have a lot of head scratching myself.  I was going to give C, but you did help.
    LVL 2

    Expert Comment

    Well done mate.  Thank yuu for the Points.
    But Becuase of snow in uk and transportation mess couldnt punt much time on your thread.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    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

    15 Experts available now in Live!

    Get 1:1 Help Now