Unzip a password protected file in vbsript

前端 未结 1 1930
感情败类
感情败类 2021-01-28 05:00

i am facing a trouble here,Could you please tell me how to unzip a password protected field in vbscript? I have a code which runs perfectly,but it asking password each time whe

相关标签:
1条回答
  • 2021-01-28 05:25

    AFAIK the Shell.Application object doesn't support providing a password. Try 7-zip instead:

    pass    = "..."
    zipfile = "your.zip"
    
    CreateObject("WScript.Shell").Run "7za.exe x -p" & pass & " " & zipfile, 0, True
    

    If necessary add the path to 7za.exe and/or file.zip. If the path contains spaces, you'll also need to put double quotes around it, e.g. like this:

    Function qq(str) : qq = Chr(34) & str & Chr(34) : End Function
    
    zipfile = qq("C:\path\with spaces\to\your.zip")
    
    0 讨论(0)
提交回复
热议问题