Jump to content

7zip using 7za.exe with extract of password


miragez
 Share

Recommended Posts

Hi to all pros

I been searching the autoit forum for very long so far I been getting very little results of extracting archive with password in it.

I tried this method

Runwait(@WorkingDir &'\7za.exe' & '" x ' & @Workingdir & '\testdoucment.7z'& "-p123456 -y -o" & '"' & @WorkingDir &'\zero' & '"')

The compiler after compiling completed, I run it using F5 and it came out thise

E:\AutoIt3\test.au3 (9) : ==> Unable to execute the external program.:

Runwait(@WorkingDir &'\7za.exe' & '" x ' & @Workingdir & '\testdoucment.7z'& "-p123456 -y -o" & '"' & @WorkingDir &'\zero' & '"')

The filename, directory name, or volume label syntax is incorrect.

I have all the folders in tact and ready to go but my method about does not work and the error message I do not understand I hope someone can help me out.

cheers

mirage

Link to comment
Share on other sites

Just wrote this function up, it should work for you, password is optional:

u7zip(@Workingdir & "\testdoucment.7z", @WorkingDir &'\zero', 123456 )

Func u7zip($archive, $dest, $pass = "")
    If $pass <> "" Then $pass = "-p" & '"' & $pass & '" '
    RunWait(@WorkingDir &'\7za.exe' & ' x "' & $archive & '" ' & $pass  & "-y -o" & '"' & $dest & '"')
EndFunc
Link to comment
Share on other sites

Thank you so much danwilli

You been a great help excellent reply I learn something new but do not understand will you tell me what does this

u7zip(@Workingdir & "\testdoucment.7z", @WorkingDir &'\zero', 123456 )

means ? I am willing to listen to what you says because I love new concept and method

And also why

If $pass <> "" Then $pass = "-p" & '"' & $pass & '" '

What is this above code also means? is it very important ?

RunWait(@WorkingDir &'\7za.exe' & ' x "' & $archive & '" ' & $pass & "-y -o" & '"' & $dest & '"')

Will you mine sharing with me when do i put a '"' & variables & '"' and when do i put " " I kinda confused with ' ' and " " and also ' " '.

Really sorry if I am asking too much I just want to learn more about it in autoit probably you can provide me to some resources which will directly help me answers those above questions.... I search the forum but not much was shown to help me understand clearly.

By providing me the code its a easy steps but I hope to learn more about it thanks again.

Link to comment
Share on other sites

This line is what calls the function u7zip() with three parameters = archive, destination, password(optional, noted by the $pass = "")

u7zip(@Workingdir & "\testdoucment.7z", @WorkingDir &'\zero', 123456 )

This line formats the $pass variable into the proper format: -p"pass" , but only if it was supplied (this way, the password is an optional variable, for 7zips that do not need a password too)

If $pass <> "" Then $pass = "-p" & '"' & $pass & '" '

In order to figure out where all the '"', etc, need to go, I replaced the RunWait(<command>), with a MsgBox(0 "test", <command>), so that I could visually see, and debug, what was being passed to cmd.exe

RunWait(@WorkingDir &'\7za.exe' & ' x "' & $archive & '" ' & $pass & "-y -o" & '"' & $dest & '"')

Will you mine sharing with me when do i put a '"' & variables & '"' and when do i put " " I kinda confused with ' ' and " " and also ' " '.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...