Create .bat file


#1

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.


#2

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.


#3

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”?


#4

indeed I choose best compresion for this.


#5

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


#6

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


#7

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.


#8

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?


#9

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.


#10

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


#11

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

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


#12

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


#13

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?


#14

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. :slight_smile:


#15

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


#16

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.


#17

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 :slight_smile:


#18

I like to use mdx file for archiving project, its compress max file too, later u can use daemon tool to mount it.


#19

7z has a very good compression rate but keep in mind it’s much slower than other solutions.


#20

Obviously, I need to say a few key points here:

#1 This compression solution need to process big project folder (500MB an above).
So compression level has to be the greatest which will produce small archive size.
Processing time is not so important here.
The user should see this process in order to know when is compression done.
To achive this we can use DOSCommand (or ShellLunch for *.bat files) fn instead of HiddenDOSCommand.

#2 The reason why I chose WinRAR(commercial) and 7zip(freeware) archiver is because
there are many users already have some of these already installed.
I did not choose WinZip because previously mentioned archivers can also create *.zip files.

@k4noe mentioned .mdx (Extended Media Descriptor File) which is disk image files.
If I decide to use any CD / DVD / BD image file processing tool I will probably pick
UltraISO (can create ISO Zipped Format [
.isz]) or PowerISO (can create Direct-Access-Archive [*.daa]). BTW *.daa files have very small size.