Jump to content

[SOLVED] winRAR command line..


efficacious

Recommended Posts

hello everyone,

 

I kno this isn't exactly php but I am using it with a php application that i'm making..

 

Basically I'm creating a executable file by using the php function

 

exec()..

 

paired up with WinRAR Archiving Program..

 

I have everything working perfectly except for 1 lil bothersome issue that absolutely must be resolved for the process to be successfull..

 

I have googled I have plain just tryed toying with different options..

I have been to winRARs site and read through the knowledge base and have even emailed winRAR support..

 

(Whom I just emailed earlier and am still waiting a response)

 

But, If anyone should happen to know this plz plz share..

 

The issue:

 

I need some sort of switch command that will let me set an extraction path..

 

Currently the extraction path defaults to the path I use to store the exe after creation..

 

Which is c:\server\wwwroot\updates

 

I need to be able to dynamically set an extraction path.. which If I can locate some sort of switch command to set a path then I can use php to handle the dynamic ability.

 

Things I've tried:

 

Path=c:\Program Files\ProgramFolder\

Path=ProgramFolder

 

-d c:\Program Files\ProgramFolder

 

neither of these work..

 

Now winRAR does have an extraction path command BUT winRAR only allows use of one command per query

 

which that command is already being used via the create process..

 

And even if I could use it (x) that command would start executing the extraction which is not what I'm trying to do.

 

hope all this makes some sense!

 

thanks for suggestions guys,

eff

 

ps(If anyone knows of another program that can fullfill these needs plz do share)

Link to comment
Share on other sites

Well because I'm deciding to be nice.. I've decided to go ahead and share this "hard to find" fix with everyone who may need it.

 

How to give your SFX archive a default extraction path:

 

In order for this to work we must create a 'comment.txt' file

now the name of the txt file doesn't have to be 'comment' however it should be of extension '.txt'

 

I know what your thinking..how does a comment file help solve the problem of adding a default extraction path in the command line.

 

Well WinRAR allows comment files to hold special commands lil something you don't find in the help files.

 

So..

 

In (Comment.txt):

Open it up in a txt editor and add one of the following lines of code to it.

Path=C:\FOLDER\PROGRAM

or

Path=Program (By Default the path would be C:\Program Files\Program)

 

thats it.

 

Now to include this in our command line code winRAR normally requires you to do this

 

Command:

WinRAR C c:\path\to\comment.txt

 

However if you are like me and your already using the 'a' command. You cannot use the command 'c'

 

Reason for this is that winRAR will only allow 1 command per query.

 

So For those like me that need this all to happen in one shabang.

 

We can use the switch '-z' like so:

 

Command:

WinRAR a -sfx file.exe -z comment.txt c:\path\to\files\to\compress\

 

hope this helps somone out there..!

 

thanksz,

eff

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.