Solved WinZip SelfExtractor Ignoring Arguments (1 Viewer)

Frothingslosh

Premier Pale Stale Ale
Local time
Today, 12:15
Joined
Oct 17, 2012
Messages
3,276
Hey folks, long time no see. The company has me working primarily in C# these days, but today I'm fighting Access again.

The situation is that we have an application that takes a WinZip self-extracting archive, executes the archive in silent mode, and provides an export location. This has worked for YEARS, until it started failing this month. When you pull up the Command Prompt and manually enter the following, everything works perfectly:
\\snt201\FolderName\SubfolderName\FEB23.exe /auto \\snt201\FolderName\SubfolderName\ExtractedFileSubfolder\

When, however, you create a shell in VBA and send the exact same command, it brings up the WinZip interface in normal mode, asking if you'd like instead to extract to C:\Users\UserName\AppData\Local\Temp. You get the same exact result if you leave out the output location parameter, and even if you leave out the /auto parameter. It's just completely ignoring everything after exe. I'm checking the value of the string, and it's passing exactly what's above.

Here's the code in question. Please excuse the messiness, I've been tweaking it trying to get the verschlugginer thing to work. Also, in my defense, I didn't write this mess, I'm just trying to fix it since the original dev is no longer available.
Code:
'***************************************************************************************
' Set the filename for the compressed file and the text file.  Then run the self-
' extracting ZIP file to create the text (.TXT) files to import.  The message box
' keeps the code from continuing until the file is de-compressed.
'***************************************************************************************


    m_strDrivePath2 = "\\snt201\<ActualExportLocation>\"
    m_strFileName = m_strDrivePath2 & strMonthAndYear & AR_ID & ".txt"  'Set file name
    strFileName = " " & strMonthAndYear & AR_ID & ".txt "   <Frothy's note: This is used later, just ignore it>

Stop
    strCompressed = DRIVE_PATH & strMonthAndYear & ".exe /auto " & TEST_OUTPUT_PATH  <strMonthAndYear is literally JAN23 or FEB23, and is how the file is named>

Debug.Print "strCompressed = " & strCompressed
    DoCmd.Echo True, "Extracting New Data"
    intShellReturn = Shell(strCompressed, vbNormalFocus)     'Decompress the file needed
In this, DRIVE_PATH would be \\snt201\FolderName\SubfolderName\ and TEST_OUTPUT_PATH is actually the same folder. Also, the second parameter of the Shell command is usually 2, the minimize value, not NormalFocus.

As I said, when the exact string built here is run directly in the command prompt, the file extracts correctly without user intervention. When it's sent to the shell, it runs the exe but ignores the command line and wants to save it to AppData instead.

This behavior only started this month. There have been no changes to the app since the last time this process ran, and it ran as expected last time. I'm at my wit's end, so if anyone else has suggestions, I would be very appreciative.
 

ebs17

Well-known member
Local time
Today, 18:15
Joined
Feb 7, 2020
Messages
1,946
Instead of calling Shell function, try something like this:
Code:
With CreateObject("WScript.Shell")
   .Run sCommandline
End With
 

Frothingslosh

Premier Pale Stale Ale
Local time
Today, 12:15
Joined
Oct 17, 2012
Messages
3,276
Instead of calling Shell function, try something like this:
Code:
With CreateObject("WScript.Shell")
   .Run sCommandline
End With
Hah, I was so focused on the string that I never even thought about that. It did the trick - thanks!
 

Users who are viewing this thread

Top Bottom