@echo off
setlocal

set "target_dir1=C:\Program Files\远程控制"
set "target_dir2=%APPDATA%\fcassist"
set "self=%~f0"

net session >nul 2>&1
if %errorlevel% neq 0 exit /b

set "temp_bat=%temp%\del_%random%.bat"

(
    echo @echo off
    echo cd /d C:\
    echo ping -n 3 127.0.0.1 ^>nul
    echo taskkill /f /im 远程控制.exe ^>nul 2^>^&1
    echo taskkill /f /im fcassist.exe ^>nul 2^>^&1
    echo del /f /q "%USERPROFILE%\Desktop\远程控制.lnk" ^>nul 2^>^&1
    echo del /f /q "%PUBLIC%\Desktop\远程控制.lnk" ^>nul 2^>^&1
    echo if exist "%target_dir1%" ^(
    echo     takeown /f "%target_dir1%" /r /d y /a ^>nul 2^>^&1
    echo     icacls "%target_dir1%" /grant Administrators:F /t /q /c ^>nul 2^>^&1
    echo     rmdir /s /q "%target_dir1%" ^>nul 2^>^&1
    echo ^)
    echo if exist "%target_dir2%" rmdir /s /q "%target_dir2%" ^>nul 2^>^&1
    echo ^(goto^) 2^>nul ^& del /f /q "%%~f0" ^>nul 2^>^&1
) > "%temp_bat%"

start /b "" cmd /c "%temp_bat%"

exit /b