这是一个powershell脚本, 也就是加入到排除监控列表
存为
去除杀毒干扰本目录.ps1
情况1:自定义wsl路径
$base_path = "D:\ubuntu1804\rootfs"
$dirs = @("\bin", "\sbin", "\usr\bin", "\usr\sbin", "\www\server")
$dirs | ForEach { Add-MpPreference -ExclusionProcess ($base_path + $_ + "\*") }
Add-MpPreference -ExclusionPath $base_path
情况2:系统默认路径
$win_user = "administrator"
$linux_user = "linux_user"
$package = "CanonicalGroupLimited.UbuntuonWindows_acdefkp1fndgsc"
$base_path = "C:\Users\" + $win_user + "\AppData\Local\Packages\" + $package + "\LocalState\rootfs"
$dirs = @("\bin", "\sbin", "\usr\bin", "\usr\sbin", "\www\server")
$dirs | ForEach { Add-MpPreference -ExclusionProcess ($base_path + $_ + "\*") }
Add-MpPreference -ExclusionPath $base_path