Error in PostExtractCommandLine

Sep 19, 2011 at 4:06 PM

I used the library to create an SFX Ionic.Zip autorun, I want to run a command file PostExtractCommandLine .exe that is within the SFX. With the command DefaultExtractDirectory predefined place to extract SFX files and when to run the .exe I receive the following error in cmd:

 

Command-Line Self Extractor generated by DotNetZip.

Extracting to C:\Documents and Settings\User Profile\Application Data <Existing file action: OverwriteSilently>

nameDirectory/

nameDirectory/library.dll

nameDirectory/library1.dll

nameDirectory/application.exe

nameDirectory/vpn.exe

Running command: C:\Documents and Settings\User Profile\Application Data\application.exe

System.ComponentModel.Win32Exception <0x80004005>: The system cannot find the file specified

at System.Diagnostics.Process.StartWithShellExecuteEx<ProcessStartInfo startInfo>

at System.Diagnostics.Process.Start<>

at System.Diagnostics.Process.Start<ProcessStartInfo startInfo>

at Ionic.Zip.CommandLineSelfExtractor.Run<>

<ENTER> to continue…

 

This is my code:

 

 public void CreateSFX(string pPath, string pNameFile, string pFileToRun, string pPathToExtract)
        {
            ZipFile zip = new ZipFile();
            zip.AddDirectory(pPath, System.IO.Path.GetFileName(pPath));
            
            SelfExtractorSaveOptions options = new SelfExtractorSaveOptions();
            options.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
            options.Flavor = SelfExtractorFlavor.ConsoleApplication;
            options.PostExtractCommandLine = pPathToExtract + "\\" + pFileToRun;
            options.DefaultExtractDirectory = pPathToExtract;
            options.Quiet = false;
            options.RemoveUnpackedFilesAfterExecute = true;

            zip.SaveSelfExtractor(pNameFile + ".exe", options);
        }
 

Thank you, Saylis

Coordinator
Sep 20, 2011 at 5:46 PM

It seems like the file you are trying to run (pFileToRun), does not exist.

You need to make sure it exists.

Sep 20, 2011 at 6:08 PM

Hello, thanks for your quick response.

In my code (pFileToRun)  is application.exe


Coordinator
Sep 21, 2011 at 3:15 PM

Yes, well, whatever the value is, YOU need to make sure it exists before trying to execute it.

Sep 21, 2011 at 3:36 PM

That is precisely the problem, the file exists, I even go to the road where you have to run and that's the file.

The issue is that the command PostExtractCommandLine not find the file and therefore not executed.

Regards...

Coordinator
Sep 21, 2011 at 5:07 PM

Yes, well, the error that you get

System.ComponentModel.Win32Exception <0x80004005>: The system cannot find the file specified

...indicates that the file does not exist, your assertions notwithstanding.  The computer knows whether the file actually exists, and it is telling you the file does not exist.

You said you even go to "the road".  I am not sure what a "road" is in this context.  You need to figure out why your view disagrees with the view of the operating system. I suggest replacing your desired command with a "dir" command (you will need to specify "%windir%\system32\cmd.exe /c dir ..." as the command) or ls.exe or something like that, redirecting the output, so you can see the contents of the directory, where you believe the application.exe file to reside.

The error you are experiencing is not the result of a problem or bug in the Dotnetzip library.  It results from a problem with your usage of the library. You'll need to figure it out. The best help I can offer to you is a suggestion on how to diagnose it.

Good luck.

Sep 21, 2011 at 6:58 PM
Edited Sep 21, 2011 at 7:05 PM

I have a similar problem.

In my case, I extract all files to a specific folder, the file should run automatically you must copy the other files that are next to him for another folder, but this does not work when I use the PostExtractCommandLine. If one command to extract and then manually run my main file, everything is done without any problems. If I use the automatic execution function does not work then it is as if it were running in a temporary folder or something, because this does not see the other files.

I've done several tests for to diagnose the problem and do not work.

Regards.

Sep 21, 2011 at 7:02 PM

I apologize for my poor English, I'm Latina. I'll try what you suggested and I will comment.

Thank you.

Coordinator
Sep 21, 2011 at 8:16 PM

it's no problem, there's no need to apologize about the english.  I only wanted to explain that I did not know what you meant by "go to the road." 

Sep 21, 2011 at 8:31 PM

When i said "go to the road" i meant "go to the path"....the file path.

Coordinator
Sep 21, 2011 at 9:34 PM

Ah, I see. that makes sense. I don't know why I didn't figure that out. In any case you'lll need to diagnose the problem yourself.

It could be a problem with spaces in the directory path.