pigface
asked on
self extracting exe
Hi,
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 VB.net 2008.
Any suggestions?
Thanks in advance!
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 VB.net 2008.
Any suggestions?
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
Just use Process.Start(Application path)
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:
ASKER
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
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
Pigface,
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.
_http://legroom.net/software/uniextract#download
If you don't want to go this route then I'll come up with a way to extract it.
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.
_http://legroom.net/software/uniextract#download
If you don't want to go this route then I'll come up with a way to extract it.
ASKER
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:
http://forums.techarena.in/windows-server-help/427088.htm
Private Sub UnZipFile(ByVal ZipFile As String, ByVal DestFolder As String)
Dim StartZip As New Diagnostics.Process
Try
StartZip.StartInfo.FileNam e = """" & ZipFile & """"
StartZip.StartInfo.Argumen ts = " /auto " & """" & DestFolder & """"
StartZip.StartInfo.WindowS tyle = ProcessWindowStyle.Hidden
StartZip.Start()
StartZip.WaitForExit()
StartZip.Close()
Dts.TaskResult = Dts.Results.Success
Catch ex As Exception
Dts.TaskResult = Dts.Results.Failure
Finally
StartZip = Nothing
End Try
End Sub
I think I should assign some points to myself too :)
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:
http://forums.techarena.in/windows-server-help/427088.htm
Private Sub UnZipFile(ByVal ZipFile As String, ByVal DestFolder As String)
Dim StartZip As New Diagnostics.Process
Try
StartZip.StartInfo.FileNam
StartZip.StartInfo.Argumen
StartZip.StartInfo.WindowS
StartZip.Start()
StartZip.WaitForExit()
StartZip.Close()
Dts.TaskResult = Dts.Results.Success
Catch ex As Exception
Dts.TaskResult = Dts.Results.Failure
Finally
StartZip = Nothing
End Try
End Sub
I think I should assign some points to myself too :)
ASKER
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.
Well done mate. Thank yuu for the Points.
But Becuase of snow in uk and transportation mess couldnt punt much time on your thread.
Cheers
But Becuase of snow in uk and transportation mess couldnt punt much time on your thread.
Cheers