中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-01 22:13
48,037 topics / 350,122 posts / today 2 new / 48,250 members
DOS批处理 & 脚本技术(批处理室) » How to implement this function with batch processing
Printable Version  2,345 / 17
Floor1 tclshx Posted 2006-07-06 11:19
中级用户 Posts 64 Credits 249
I'm using a genuine version of Rising Antivirus. I want to create an IMG file for Rising Antivirus. The key is to extract the virus database files from RISING\RAV. The virus database files are: 8 def files (VirBoot.def, VIRCOM.def, VirInfo.def, VirMacr.def, VirMZ.def, VirNorm.def, VirPe.def, VirSct.def), 15 dll files (engine.dll, extFile.dll, ExtMail.dll, ExtOLE.dll, libload.dll, RsStore.dll, ScanEX.dll, ScanExec.dll, ScanMac.dll, ScanSct.dll, slang936.dll, UnExe.dll, vdp.dll, VirusLib.dll, Zip.DLL), and one virusdb.cfg file. Also, I need to create a Version.inf file according to the content of the virusdb.cfg file (the date and version number in the content will be different each time it's updated). Here I list the content of virusdb.cfg after the update on June 26, 2006:


FILECOUNT=13
ENGINEVER=17.00.00.36
VIRDEFVER=18.32.42.00
VIRDEFUPDATEDATE=2006-06-23


COM=VirCom.def
MZ=VirMZ.def
PE=VirPe.def
MACRO=VirMacr.def
SCRIPT=VirSct.def
NORMAL=VirNorm.def
BOOT=VirBoot.def
ELF=VirElf.def
INFO=VirInfo.def
MEM=SysMem.def
PTLIB=Posttrt.def
WLLIST=wllib.def
NVLIST=nvlib.def


INFO=VirusLib.dll
MEM=VirusLib.dll
PTLIB=VirusLib.dll
WLLIST=VirusLib.dll
NVLIST=VirusLib.dll

Also listed is the content of VERSION.INF created manually according to VIRUSDB.CFG:


VersionNo=18.32.42
UpdateDate=2006-06-23

The VERSION.INF file is used to display the version number. It's very cumbersome to create VERSION.INF manually each time. I want to use a batch process to achieve this. Could some kind - hearted person help?

The following is the batch process I put in the RISING directory to extract virus files. I just need to add the function to create the VERSION.INF file later. The created VERSION.INF should also be in the 001 directory.

MD 001
COPY /Y .\Rav\VirBoot.def .\001
COPY /Y .\Rav\VirCom.def .\001
COPY /Y .\Rav\VirInfo.def .\001
COPY /Y .\Rav\VirMacr.def .\001
COPY /Y .\Rav\VirMZ.def .\001
COPY /Y .\Rav\VirPe.def .\001
COPY /Y .\Rav\VirSct.def .\001
COPY /Y .\Rav\ENGINE.DLL .\001
COPY /Y .\Rav\EXTFILE.DLL .\001
COPY /Y .\Rav\EXTMAIL.DLL .\001
COPY /Y .\Rav\EXTOLE.DLL .\001
COPY /Y .\Rav\LIBLOAD.DLL .\001
COPY /Y .\Rav\RsStore.dll .\001
COPY /Y .\Rav\ScanEx.dll .\001
COPY /Y .\Rav\SCANEXEC.DLL .\001
COPY /Y .\Rav\SCANMAC.DLL .\001
COPY /Y .\Rav\SCANSCT.DLL .\001
REM COPY /Y .\Rav\sLang936.dll .\001
COPY /Y .\Rav\Unexe.dll .\001
COPY /Y .\Rav\VDP.DLL .\001
COPY /Y .\Rav\VirusLib.dll .\001
COPY /Y .\Rav\ZIP.DLL .\001
COPY /Y .\Rav\VirNorm.def .\001
COPY /Y .\Rav\VIRUSDB.CFG .\001

[ Last edited by tclshx on 2006-7-6 at 11:39 ]
Floor2 bagpipe Posted 2006-07-06 12:49
银牌会员 Posts 425 Credits 1,144 From 北京
@echo off
setlocal
for /f "tokens=2 delims==" %%a in ('findstr /c:"VIRDEFVER" /c:"VIRDEFUPDATEDATE" virusdb.cfg') do (
if defined a (set b=%%a) else set a=%%a
)
echo [Version]>.\001\VERSION.INF
echo VersionNo=%a:~0,-3%>>.\001\VERSION.INF
echo UpdateDate=%b%>>.\001\VERSION.INF



@echo off
setlocal
for /f "tokens=2 delims==" %%a in ('findstr "VIRDEFVER VIRDEFUPDATEDATE" virusdb.cfg') do (
if defined a (set b=%%a) else set a=%%a
)
echo [Version]>.\001\VERSION.INF
echo VersionNo=%a:~0,-3%>>.\001\VERSION.INF
echo UpdateDate=%b%>>.\001\VERSION.INF


Both should work, just changed the search...
Floor3 fastslz Posted 2006-07-06 13:35
铂金会员 Posts 2,315 Credits 5,493 From 上海
@echo off
set Version=VIRDEFVER
find /i virusdb.cfg "%Version%"
if not errorlevel 1 set Version=VersionNo
for /F "tokens=1 delims=VIRDEFVER " %%A in ('find /i .\Rav\virusdb.cfg "VIRDEFVER"') do set No=%%A
for /F "tokens=1 delims=VIRDEFUPDATEDATE " %%B in ('find /i .\Rav\virusdb.cfg "VIRDEFUPDATEDATE"') do set DATENO=%%B
echo >.\001\VERSION.INF
echo %Version%%NO%>>.\001\VERSION.INF
echo UpdateDate%DATENO%>>.\001\VERSION.INF

[ Last edited by fastslz on 2006-7-6 at 13:53 ]
Floor4 fastslz Posted 2006-07-06 13:49
铂金会员 Posts 2,315 Credits 5,493 From 上海
Hehe... Compared with bagpipe, my method is relatively clumsy. But I have tested it. Please add the path, building block: When the full path of this.\Rav\ virtual path is C:\Program Files\Rav, there will be an error prompt.
Floor5 bagpipe Posted 2006-07-06 13:56
银牌会员 Posts 425 Credits 1,144 From 北京
What matters is the method, not being smart or not. Everyone has different ideas, but it's okay as long as the results are the same. Everyone is here for learning, and everyone starts from being inexperienced, so it's all the same
Floor6 tclshx Posted 2006-07-06 15:39
中级用户 Posts 64 Credits 249
Originally posted by bagpipe at 2006-7-6 12:49 PM:
@echo off
setlocal
for /f "tokens=2 delims==" %%a in ('findstr /c:"VIRDEFVER" /c:"VIRDEFUPDATEDATE" virusdb.cfg') do (
if defined a (set b=%%a) else set a=%%a
)
e ...


The result of the second floor is:
The content of VERSION.INF is

VersionNo=~0,-3
UpdateDate=

The result of the third floor is:
The content of VERSION.INF is

VIRDEFVER=18.34.31.00
UpdateDate=2006-07-06

The correct one should be
The content of VERSION.INF is

VIRDEFVER=18.34.31
UpdateDate=2006-07-06
Otherwise, when running the IMG of Rising DOS antivirus, the version number cannot be displayed correctly (version: 18.34.31)
Floor7 bagpipe Posted 2006-07-06 16:16
银牌会员 Posts 425 Credits 1,144 From 北京
You first take a look at where your problem is, don't just focus on the result. Why didn't I have the situation you mentioned when I tested it on my local machine?
Floor8 tclshx Posted 2006-07-06 16:25
中级用户 Posts 64 Credits 249
Originally posted by bagpipe at 2006-7-6 04:16 PM:
You first take a look at where your problem is, don't just focus on the result. I tested it on my local machine and didn't encounter the situation you mentioned.

My Rising antivirus is installed on drive D. I placed this batch processing in the RISING directory, and the RAV directory is also in this directory.
My entire batch processing is as follows:
@echo off
MD 001
COPY /Y .\Rav\VirBoot.def .\001
COPY /Y .\Rav\VirCom.def .\001
COPY /Y .\Rav\VirInfo.def .\001
COPY /Y .\Rav\VirMacr.def .\001
COPY /Y .\Rav\VirMZ.def .\001
COPY /Y .\Rav\VirPe.def .\001
COPY /Y .\Rav\VirSct.def .\001
COPY /Y .\Rav\ENGINE.DLL .\001
COPY /Y .\Rav\EXTFILE.DLL .\001
COPY /Y .\Rav\EXTMAIL.DLL .\001
COPY /Y .\Rav\EXTOLE.DLL .\001
COPY /Y .\Rav\LIBLOAD.DLL .\001
COPY /Y .\Rav\RsStore.dll .\001
COPY /Y .\Rav\ScanEx.dll .\001
COPY /Y .\Rav\SCANEXEC.DLL .\001
COPY /Y .\Rav\SCANMAC.DLL .\001
COPY /Y .\Rav\SCANSCT.DLL .\001
REM COPY /Y .\Rav\sLang936.dll .\001
COPY /Y .\Rav\Unexe.dll .\001
COPY /Y .\Rav\VDP.DLL .\001
COPY /Y .\Rav\VirusLib.dll .\001
COPY /Y .\Rav\ZIP.DLL .\001
COPY /Y .\Rav\VirNorm.def .\001
COPY /Y .\Rav\VIRUSDB.CFG .\001

setlocal
for /f "tokens=2 delims==" %%a in ('findstr /C:"VIRDEFVER" /C:"VIRDEFUPDATEDATE" virusdb.cfg') do (if defined a (set b=%%a) else set a=%%a)
echo >.\001\VERSION.INF
echo VersionNo=%a:~0,-3%>>.\001\VERSION.INF
echo UpdateDate=%b%>>.\001\VERSION.IN

I tried both of your batch processings, and the content of VERSION.INF is the same:

VersionNo=~0,-3
UpdateDate=
Floor9 bagpipe Posted 2006-07-06 17:21
银牌会员 Posts 425 Credits 1,144 From 北京
I want to ask where the location of your "virusdb.cfg" file is?
Floor10 tclshx Posted 2006-07-06 17:24
中级用户 Posts 64 Credits 249
Originally posted by bagpipe at 2006-7-6 05:21 PM:
I want to ask where the location of your "virusdb.cfg" file is?


The virusdb.cfg file is copied from the RAV directory to the 001 directory by the batch processing.
Floor11 bagpipe Posted 2006-07-06 17:28
银牌会员 Posts 425 Credits 1,144 From 北京
Then he just can't find that file. Try 'findstr /C:"VIRDEFVER" /C:"VIRDEFUPDATEDATE" .001\virusdb.cfg' again. By the way, what system are you using?
Floor12 tclshx Posted 2006-07-06 17:29
中级用户 Posts 64 Credits 249
Originally posted by bagpipe at 2006-7-6 05:28 PM:
Then he just can't find that file
'Try 'findstr /C:"VIRDEFVER" /C:"VIRDEFUPDATEDATE" .001\virusdb.cfg' again. By the way, what system are you using?


XP_sp2
Floor13 bagpipe Posted 2006-07-06 17:31
银牌会员 Posts 425 Credits 1,144 From 北京
You can try modifying it. This is the reason for not finding that CFG file
Floor14 bagpipe Posted 2006-07-06 17:36
银牌会员 Posts 425 Credits 1,144 From 北京
I just made a mistake with the path earlier. It should be .\001\virusdb.cfg like this.
Floor15 tclshx Posted 2006-07-06 17:37
中级用户 Posts 64 Credits 249
Originally posted by bagpipe at 2006-7-6 05:31 PM:
Try modifying it. This is the reason for not finding that CFG file



setlocal
for /f "tokens=2 delims==" %%a in ('findstr /C:"VIRDEFVER" /C:"VIRDEFUPDATEDATE" virusdb.cfg') do (if defined a (set b=%%a) else set a=%%a)
echo >.\001\VERSION.INF
echo VersionNo=%a:~0,-3%>>.\001\VERSION.INF
echo UpdateDate=%b%>>.\001\VERSION.IN
Changed to
setlocal
for /f "tokens=2 delims==" %%a in ('findstr /C:"VIRDEFVER" /C:"VIRDEFUPDATEDATE" .001\virusdb.cfg') do (if defined a (set b=%%a) else set a=%%a)
echo >.\001\VERSION.INF
echo VersionNo=%a:~0,-3%>>.\001\VERSION.INF
echo UpdateDate=%b%>>.\001\VERSION.INF

The result is still the same as before modification.

The one on the third floor just adds ".00" after the version number in the result. The improvement he made might work, but I don't know how.
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023