Hi. I am extracting a daily ZIP file into a existing folder and starting the process via a Start Process activity which starts 7-ZIP and provides the required arguments. The reason I am using 7-ZIP is that after the extraction is done I need to identify new files received within the last day. When I use the inbuilt unzip activity is changes the file creation/modification date to the date/time the extraction is done, whereas 7-ZIP maintains the date/time of the original file in the ZIP file.
I have the correct arguments in the Start Process activity, however the problem I have is that the command prompt is closed after it starts before the extraction has had a chance to run. I have changed the Execution Type from both Asynchronously and Synchronously but this didn’t make any difference. Also set the Timeout but this didn’t change anything.
Any suggestions how I can keep the command window open until it completes the extraction, or another way to trigger 7-ZIP?
Hi @Yoichi . I have tried both Invoke Code and Start Process activity. The outcome is the same being that the CMD window opens to execute the command but close straight away even though the process inside the CMD window hasn’t completed.
How about the following code? (Set UseShellExecute True)
Dim pinfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo()
pinfo.FileName = "C:\Program Files\7-Zip\7z.exe"
pinfo.UseShellExecute =True
pinfo.Arguments ="x targetfile.zip"
Dim p As System.Diagnostics.Process = New System.Diagnostics.Process()
p.StartInfo = pinfo
p.Start()
p.WaitForExit()
BTW, what is your purpose to keep cmd window open?
The first my sample returns output of console as string variable.