niki chan May 22, 2009 at 01:44:29 Specs: Windows XP, 3.4
hi i need a batch code (.bat ) for archive my files with winrar in my current folder there is a folder called "company" there is a program that copy some different files every few days or week to company folder names of files that are being copied= daily updat.exe weekly source.exe patch.exe other files= (*.exe *.dll *sys * dat) what i need = 1- i want to compress every file in a separate .rar archive 2- program should search for (daily updat.exe , weekly source.exe patch.exe )if find them compress them one by one 3- sometimes there is just one or 2 of them so if it did'nt find 1 file it should search for other ones 4- program should not add folder to archived rar file just add each file without adding "container" folder to archive or any folder 5-if program find other (.exe .dll .sys .dat ) files it should add them all to one rar archive (all together) and name it other files.rar
i found this code but it work correct if all files exist or it wont work ok
cd company\ set path=C:\program files\winrar\;%path% winrar a -ibck daily updat.exe
path C:\Program Files\WinRAR;%path%
for %%f in ("daily updat.exe" "weekly source.exe" patch.exe) do (
if exist %%f rar a -m5 %%~nf %%f
rar a -m5 -x"daily updat.exe" -x"weekly source.exe" -xpatch.exe "other files" *.exe *.dll *.sys *.dat
what if in another pc winrar was installed on another drive or location? i know that i can change path manualy but because i want to turn these batch code into exe is there any other way for future? for example= user make a txt file in drive C: and name it path winrar.txt and type winrar exact path is it possible for this batch code to search for winrar and if it was path C:\Program Files\WinRAR;%path% ok everything is correct and can continue but if it was not search for C:\path winrar.txt to find the winrar address? and then go to next line in batch codes and continue the rest? if its possible put the codes for batch code and example .txt file thank you very very much
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Purch hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.