Skip to content

Instantly share code, notes, and snippets.

@tassoman
Last active October 15, 2025 13:21
Show Gist options
  • Select an option

  • Save tassoman/a3e6fbbbc0e69aa4e56610429d0cb3c6 to your computer and use it in GitHub Desktop.

Select an option

Save tassoman/a3e6fbbbc0e69aa4e56610429d0cb3c6 to your computer and use it in GitHub Desktop.
A simple ClamAV integration with Windows
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\RunClamScan]
@="ClamAV, scan all Folders"
"Icon"="\"%ProgramFiles%\\ClamAV\\clamscan.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\RunClamScan\command]
@="\"%USERPROFILE%\\RunClamScan-Dir.bat \"%V\""
[HKEY_CLASSES_ROOT\Directory\background\shell\Powershell]
@="@shell32.dll,-8508"
"Extended"=""
"NoWorkingDirectory"=""
"ShowBasedOnVelocityId"=dword:00639bc8
[HKEY_CLASSES_ROOT\Directory\background\shell\Powershell\command]
@="powershell.exe -noexit -command Set-Location -literalPath '%V'"
[HKEY_CLASSES_ROOT\*\shell\RunClamScan]
@="ClamAV, scan a File"
"Icon"="\"%ProgramFiles%\\ClamAV\\clamscan.exe\",0"
[HKEY_CLASSES_ROOT\*\shell\RunClamScan\command]
@="\"%USERPROFILE%\\RunClamScan-File.bat \"%V\""
<?xml version="1.0" encoding="UTF-16"?>
<!-- :: Released (CC-BY-SA-NC) https://gist.github.com/tassoman/a3e6fbbbc0e69aa4e56610429d0cb3c6 -->
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2024-10-12T03:16:13.9237462</Date>
<Author>WIN10\Administrator</Author>
<Description>ClamAV Viruses Database update task</Description>
<URI>\FreshClam</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<Repetition>
<Interval>PT1H</Interval>
<Duration>P1D</Duration>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2024-10-12T04:10:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-1301962884-447142648-441302601-500</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>%USERPROFILE%\RunFreshClam.bat</Command>
</Exec>
</Actions>
</Task>
@echo off
:: Released (CC-BY-SA-NC) https://gist.github.com/tassoman/a3e6fbbbc0e69aa4e56610429d0cb3c6
if "%~1"=="" (
echo Please provide a File to scan.
exit /b
)
"C:\Program Files\ClamAV\clamscan.exe" "%~1"
timeout /t 30
@echo off
:: Released (CC-BY-SA-NC) https://gist.github.com/tassoman/a3e6fbbbc0e69aa4e56610429d0cb3c6
if "%~1"=="" (
echo Please provide a directory to scan.
exit /b
)
"C:\Program Files\ClamAV\clamscan.exe" "%~1" --recursive
timeout /t 30
@echo off
:: Released (CC-BY-SA-NC) https://gist.github.com/tassoman/a3e6fbbbc0e69aa4e56610429d0cb3c6
:: Switch comments, for debug purposes.
:: "C:\Program Files\ClamAV\freshclam.exe" --stdout
"C:\Program Files\ClamAV\freshclam.exe"
:: Play three beeps at 2450 Hz, 500 ms long, with 50 ms pause
for /l %%i in (1,1,3) do (
powershell -c "[console]::beep(2450, 500)"
:: ping -n 1 -w 25 127.0.0.1 >nul
)
:: Optional: Add a final timeout if you want to wait after the beeps
:: timeout /t 5
@tassoman
Copy link
Author

tassoman commented Oct 13, 2024

I made this simple integration of ClamAV in windows.

You can automagically ™️ keep virus database updated, and run virus check on demand inside File Explorer. Just right click the file or folder.

When you install ClamAV, consider to use default path configuration.
Also remember to install it as service: "c:\Program Files\ClamAV\clamd.exe" --install-service

Usage

  1. Download all files and extract them into your profile folder C:\Users\YourName.
  2. Import Registry keys (maybe you want to configure them).
  3. Import the XML scheduled task (maybe you want to configure it).

Released under (CC-BY-NC-SA)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment