Jump to content

Recommended Posts

Posted

Hi all,

I have an problem with the Run command.

I want to extract an .zip file with 7zip(7za.exe file)

this can you do at the command prompt so i though i run this command in autoit

Run(@ComSpec & ' /c ' & '"' & $7za.exe_file & '"' & ' x "' & $File_to_extract & '" -o"' & $Where_to_extract & '"' , "", @SW_HIDE, 2 + 4)

but this won't work but if i run it just at the command prompt an i type it in manually it work.

what did i do wrong??

Thanks in advance:)

Posted (edited)

Something I had in my Script Folder.

Func _7Zip($7z_File, $7z_Folder = @ScriptDir, $7z_Password = "")
    If Not FileExists($7z_File) Then Return SetError(1, 1, 0)
    If StringRight($7z_Folder, 1) <> "\" Then $7z_Folder &= "\"
    If Not FileExists($7z_Folder) Then DirCreate($7z_Folder)
    If $7z_Password <> "" Then $7z_Password = "-p" & '"' & $7z_Password & '" '
    If Not FileExists(@ScriptDir & "\" & "7za.exe") Then Return SetError(1, 1, 0)
    Return RunWait('7za.exe' & ' x "' & $7z_File & '" ' & $7z_Password & "-y -o" & '"' & $7z_Folder & '"', "", @SW_HIDE)
    Return SetError(1, 2, 0)
EndFunc   ;==>_7Zip
Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

@OP

This is what the help file says on variable naming:

  Quote

Each variable has a name (again, similar to a mailbox) and must start with the $ character and may only contain letters, numbers and the underscore _ character

Posted (edited)

  Quote

what is better about yours??

It works! :x I don't understand why you have to use @ComSpec? Maybe take the . out of $7za.exe_file

Edit: whim beat me to it!

Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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