FRISK Software International

Product: F-PROT Antivirus for Windows
Version: 6

How to create a script to automate the copying of files

You may create a script to automate the copying of virus signature file (antivir.def) and settings files (config.xml, tasks.xml, exclusion.xml) to the update location and then schedule it to run regularly, e.g. hourly.

To automate the copy of antivir.def and settings files to a shared update location:

The user can choose between two options:
  • Change the line

    set DEFAULT_DEST_PATH=\\server\fpav-update

    to include the correct destination path
  • Pass the destination path as the first command line parameter. If no such parameter is given, the default value from the 1st option is used.

The Script

@echo off
@if "%OS%"=="Windows_NT" goto :MAIN
@echo This script requires Windows 2000 or later to run properly!
goto :EOF

:: Script to copy files from an existing installation of FPAV to a 
:: network share or arbitrary other directory.
:: Usage:
:: Change the variable DEFAULT_DEST_PATH to your destination path 
:: (directory) and the script should take care of the rest.
:: Alternatively give the destination path at the first parameter.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::/ MAIN subroutine :: Receives the command line parameters ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :MAIN setlocal ENABLEEXTENSIONS set DEFAULT_DEST_PATH=\\server\fpav-update if not "%1" == "" set DEST_PATH=%1 if not DEFINED DEST_PATH set DEST_PATH=%DEFAULT_DEST_PATH% set DEST_PATH=%DEST_PATH:"=% set SRC_PATH_SUFFIX=FRISK Software\F-PROT Antivirus for Windows set FILES_TO_COPY=antivir.def config.xml tasks.xml exclusions.xml set SRC_PATH=%APPDATA% call :GetFilePart SRC_PATH set SRC_PATH=%ALLUSERSPROFILE%\%SRC_PATH%\%SRC_PATH_SUFFIX% for /D %%i in (%FILES_TO_COPY%) do @( if exist "%SRC_PATH%\%%i" @( echo Copying %%i xcopy /Y /K /D "%SRC_PATH%\%%i" "%DEST_PATH%" ) else ( echo "%SRC_PATH%\%%i" does not exist! ) ) endlocal goto :EOF ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::/ GetFilePart subroutine ::There is only one parameter, the name of the variable which contains ::the full path and receives the last part after the last backslash. The ::function extracts the part after the last backslash. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :GetFilePart setlocal ENABLEEXTENSIONS & set VAR_NAME=%1 set VAR_TEMPRET2=%%%VAR_NAME%%% :GetFilePartLoop set VAR_TEMPRET1=%VAR_TEMPRET2% set VAR_TEMPRET2=%VAR_TEMPRET1% for /f "tokens=1,* delims=\" %%i in ('echo %VAR_TEMPRET1%') do ( if not "%%j" == "" set VAR_TEMPRET2=%%j ) if not "%VAR_TEMPRET1%" == "%VAR_TEMPRET2%" goto :GetFilePartLoop endlocal & set %VAR_NAME%=%VAR_TEMPRET1% goto :EOF

Please note that any combination of these files (antivir.def, config.xml tasks.xml exclusions.xml) can be copied to the shared update location and none of them are required, F-PROT Antivirus will update all that is available and more recent than what it has.

After creating the script file, you may then create a scheduled task to automate file copy to the update location. You can use the Windows Scheduler to perform this task.

See also:

Feedback | Contact Technical Support | Contact Sales Support

F-PROT Antivirus
- for Windows
- for UNIX
- for Exchange
F-PROT Antivirus
- for Windows
- for UNIX
- for Exchange
Stay up to date with life cycle policies for F-PROT Antivirus for Windows.
Definitions of common antivirus terminology.