Jump to content

Can i rar file with winrar


Recommended Posts

Hello i am new here and i have a few questions if it is possible to take a file and rar it with winrar with a command, is there any guide because i searched but didnt find anything clear. So is there any command because couldnt find anything in helpfile.

Link to comment
Share on other sites

Thanks i have found a text helpfile at winrar folder but i have a few questions here.

Sorry my englosh isnt very good and i need someone to describe them a bit more since i cant understand everything well

Syntax

RAR <command> [ -<switches> ] <archive> [ <@listfiles...> ]

[ <files...> ] [ <path_to_extract\> ]

do u always need command because couldnt find any command that rar files

Switches are designed to modify the way RAR performs the action..

what exactly switces do, does it mean if it will be hidden or not?

Other

parameters are archive name and files to be archived into or extracted

from the archive.

couldnt understand a lot from that one, what is archive?

Listfiles are plain text files that contain names of files to process.

we put here txt files that have names inside, what exactly are the names inside?

File names should start at the first column. It is possible to

put comments to the listfile after // characters

no idea what files we put here :P need a little help in that too

path to extract

does this work for when u need to rar files or when u unrar them? or is it where it will put new .rar file?

also Authenticity what exactly is that code u posted?

is there any command that opens command line without needed to find it at computer? and how exactly i write command with that syntax no idea how it works in autoit.

open dos command?

send(rar <a> [ switche ] <archive> [ .\file.txt ] [ .\file.wav ] [c:\program files\rar])

your help will be apriciated a lot

Link to comment
Share on other sites

First it runs Winrar from it's directory which is assumed to be in @ProgramFilesDir ("C:\Program Files" for example) with the parameters "a" - as the command for add or compress, "C:\Destination" - as the destination file , "C:\Source" - for the source files or folder (watch the other switches for recursively compression of entire folder and it's sub-items). In short, I don't understand it completely myself but it's just add this C:\Source to C:\Destination rar file using the a command.

Edited by Authenticity
Link to comment
Share on other sites

oh man thanks very much i learned how it works, now i only need some more inforamtions

for the source and destination file in the programm i try to make, its a folder in scriptdir and its name in in an input so how exactly i can do that,

1) where exactly i put @scriptdir if i want to count for both destination and source file?

2) name of folder is unknown and the only way to know it is read input, so where exactly i can add guictrlread($input1)

i want to do something like that but i am sure syntax is very wrong

i have put winrar folder at scriptdir too

Dim $sWinRAR = @scriptDir & '\winrar\'
Run($sWinRAR & @scriptdir & 'winrar a "" "guictrlread($input1)"

1) destination should be at scriptdir and i dont know what else to write at destination's "" 2)where i put guictrlread($input1) because i dont know:/

Edited by jim1
Link to comment
Share on other sites

The GuiCtrlRead is not safe for direct Run call because it may return an empty string and thus won't work, check to see if it's not an empty string first.

Dim $sWinRAR = @ScriptDir & '\winrar\winrar.exe' ; Better than doing it later in the Run call.
$sInput = GuiCtrlRead($input1)
If $sInput <> "" Then   Run($sWinRAR & 'a "' & $sInput & '" C:\Source') ; Mind to share what is the intention? source, dest?
Link to comment
Share on other sites

input read is for the source file,

@scriptdir is for both source and destination file.

a question about code what is the use of <> and "" at the if/then place.

Also i am a confused with " and ' . where we put " and when ' because i see many of them in strange places at code.

Will this work for a button inside and if/endif?

Link to comment
Share on other sites

Without " the path would be delimited if it contains a space character and won't refer to the correct one. So, "C:\Program Files" is shown as:

1)C:\Program

2)Files

but with double "" it's like this - """C:\Program Files""":

1)"C:\Program Files" (including the double quotes).

Or simple, and much prettier.

'"C:\Program Files"'

1)"C:\Program Files" (including the double quotes).

I don't know about your english, but mines is probably isn't better than yours. What I don't understand I check in an online dictionary. =] Read the WinRAR help file.

Link to comment
Share on other sites

thanks again for the help

do u know any way to write paths without main C? i use the prog with a usb stick and the path changes every time i put it on other computer since sometimes it is "d:\gamefiles\filr.txt" or "h:\gamefiles\filr.txt" or "e:\gamefiles\filr.txt"

Link to comment
Share on other sites

DriveGetDrive() or FileExists, etc.. It's perfectly valid to compress a file or folder on another drive, like:

C:\Program Files\WinRAR> winrar a "G:\Dest" "C:\Source.bmp"

Anyway, you'll probably have to check if the return array of DriveGetDrive() contains "C:" or "H:" for example.

Link to comment
Share on other sites

thanks for ur patience

i tried that but again i cant write between the dest and source file and cant add the variable at source without taking dest too

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("1", 372, 238, 454, 334)
$1 = GUICtrlCreateInput("Input1", 60, 92, 257, 21)
$Button1 = GUICtrlCreateButton("Button1", 60, 136, 105, 33, 0)
$Button2 = GUICtrlCreateButton("Button2", 196, 136, 101, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$var = DriveGetDrive( "removable" ); removable should be for usb stick?

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            if $msg = $button1 Then
Dim $sWinRAR = @scriptDir & '\winrar\winrar.exe'
Run($sWinRAR & 'winrar a "C:\" & $var  & ":\try\1"'); will it work with : ? 
endif

    EndSwitch
WEnd
Edited by jim1
Link to comment
Share on other sites

concatenating strings and variables content requires special caution ;] . First make sure you see the string correctly before passing it to the Run or any similar functions:

Dim $sWinRAR = @scriptDir & '\winrar\winrar.exe'
Run($sWinRAR ' a "C:\Dest' & '" "' & $var[1] & '\try\1"')

I know it may seem confusing but testing is the way to go if you're not sure, read the help file about these functions, some return arrays some may return an empty string. Also, preform a check so you won't get unpredictable results. Sorry, I can't be of help ;]

Edited by Authenticity
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...