Notifications
Clear all

[Closed] Create .bat file

I need a two simple functions that creates two .bat file which will by using ShellLaunch fn compress all files in dir and sub-dirs into a single archive (.7z and .rar).
So first fn will use 7zip archiver and second WinRAR.
Thanks in advance.

38 Replies

i use winrar…might little help for ya…
its raw, but you get the idea…


rarPath= "C:\\Program Files\\WinRAR"  ---we setting it via script
	rarProg="rar.exe"
	Winrar="\""+rarPath+"\""+" "+rarProg
	doWinRAR= "start /d" +" "+ Winrar
	theSwitch="a -ac -ai  -ep1 -kb -m5 -ibck -os -rr3p -s -df -ds -ed -r -y"
	DestinationRAR=myRarFile
	SourceRAR=AllFileInMyDir ---in one folder
	StartWinRAR=doWinRAR+" "+theSwitch+" "+"\""+DestinationRAR+"\""+" "+"\""+SourceRAR+"\""
	
	DOSCommand StartWinRAR

basicly you must copy all file you need in one folder before you rar it.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

With .bat will be probably similar. Very cool, friend.
Tell me is this highest commpresion methot ei. “Best”?
For 7zip can you do similar approch?
edit:
Why do you separate “rarPath” and “rarProg”?

indeed I choose best compresion for this.

what NET framework version does max 2014 use? is it 4.5?

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

I think 3.5 or 4 not 4.5 for sure. But I use win8.1 that comes with the version 4.5.1
Why U ask? Are you suggest something different ei.better?:hmm: I’m listening

System.IO.Compression.ZipFile
http://msdn.microsoft.com/en-us/library/System.IO.Compression%28v=vs.110%29.aspx

it works very well. but i haven’t tried it with max yet.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Yup. max 2014 not recognize this class. So I need to stay with rar and 7zip.
Can you show me how to make theses two fn’s that I describet above?

I’ve also read this article but I can’t ask from any user to install this to be able to use some feature in my tool. But 80% win users already have installed winrar or 7zip. So it is easier that way.

you don’t need .bat for that. use HiddenDOSCommand…

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

How?
I not undertand how correctly write string pattern. Also if folder is big maybe is better allow user to see progress


  HiddenDOSCommand "rar a -r archivename.rar *.* folderfrom"

which means:
using rar archive -recursive into file all files from folder…

2 Replies
(@gazybara)
Joined: 11 months ago

Posts: 0

What about compression level. Fajar is used this pattern “a -ac -ai -ep1 -kb -m5 -ibck -os -rr3p -s -df -ds -ed -r -y”.
Why everybody avoid 7z which is free and use better compression algoritam then rar?

(@denist)
Joined: 11 months ago

Posts: 0

i don’t know all keys. you probably have to read a documentation for winrar command line options.
but as i know the difference is minimal. the default setting are working well. bit of course you always have an option to make something fancy.

Fancy is cool
I think -m5 is compress-level (Best). 7zip use -m9 or something like that for Ultra compression.

maybe. and it makes a compressed file 10% smaller than default, but makes it 5 times slower.
all fancy compression algorithms are usually used for compression specific or ‘bad’ data. like white noise for example.

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

About that U are right. I need to compress whole project folder which is in most cases 500-1000MB. That’s why I want best compress level and to know when is process done.
With HDC I can’t see this and I know that this can be very slow.
I tried once KGB archiver with max level. Compression is amazing but this can take 24h

Page 1 / 3