asp中的7z代码并不工作,但WINZIP工作正常

时间:2014-11-26 08:19:59

标签: asp-classic 7zip

我在ASP中有一段特殊的代码

Sub CreateZipFile(strZipPath, arrFilesPath)
    PKZIP_FILE_NAME="c:\PROGRA~1\Winzip\WINZIP32.EXE"
    Dim strCommand, objShell, objFSO
    Dim x

    'first verify pkzip exists:
    Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
    If Not(objFSO.FileExists( PKZIP_FILE_NAME )) Then
        Set objFSO=Nothing
        Err.Raise 20000, "Zip File Creator", "zip utility not found: "&PKZIP_FILE_NAME
    End If

    If objFSO.FileExists(strZipPath) Then
        objFSO.DeleteFile(strZipPath)       
    End If

    Set objFSO=Nothing  
    strCommand=PKZIP_FILE_NAME&" -a "&strZipPath&" "
    strCommand=strCommand&arrFilesPath
    Set objShell=Server.CreateObject("WScript.Shell")
    objShell.Run strCommand, 0, True    
    Set objShell=Nothing

End Sub  

这是正确的,工作正常。

现在我想使用7z而不是WinZip

我写了以下代码。它不起作用......

Sub CreateZipFile(strZipPath, arrFilesPath)
    PKZIP_FILE_NAME="c:\PROGRA~1\7Zip\7za.EXE"
    Dim strCommand, objShell, objFSO
    Dim x

    'first verify pkzip exists:
    Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
    If Not(objFSO.FileExists( PKZIP_FILE_NAME )) Then
        Set objFSO=Nothing
        Err.Raise 20000, "Zip File Creator", "zip utility not found: "&PKZIP_FILE_NAME
    End If

    If objFSO.FileExists(strZipPath) Then
        objFSO.DeleteFile(strZipPath)       
    End If
    Set objFSO=Nothing  

    strCommand=PKZIP_FILE_NAME&" a "&strZipPath&" "

    strCommand=strCommand&arrFilesPath

    Set objShell=Server.CreateObject("WScript.Shell")

    objShell.Run strCommand, 0, True    

    Set objShell=Nothing

End Sub  

有人可以帮助我吗?

0 个答案:

没有答案