Skip to content

Instantly share code, notes, and snippets.

@janasco
Created August 3, 2023 09:46
Show Gist options
  • Save janasco/c6168d17ed6eb4b6eaf7fd46fb775f60 to your computer and use it in GitHub Desktop.
Save janasco/c6168d17ed6eb4b6eaf7fd46fb775f60 to your computer and use it in GitHub Desktop.
AnyDesk Reset
@echo off & setlocal enableextensions
title Reset AnyDesk
reg query HKEY_USERS\S-1-5-19 >NUL || (echo Please Run as administrator.& pause >NUL&exit)
chcp 437
call :stop_any
del /f "%ALLUSERSPROFILE%\AnyDesk\service.conf"
del /f "%APPDATA%\AnyDesk\service.conf"
copy /y "%APPDATA%\AnyDesk\user.conf" "%temp%\"
rd /s /q "%temp%\thumbnails" 2>NUL
xcopy /c /e /h /r /y /i /k "%APPDATA%\AnyDesk\thumbnails" "%temp%\thumbnails"
del /f /a /q "%ALLUSERSPROFILE%\AnyDesk\*"
del /f /a /q "%APPDATA%\AnyDesk\*"
call :start_any
:lic
type "%ALLUSERSPROFILE%\AnyDesk\system.conf" | find "ad.anynet.id=" || goto lic
call :stop_any
move /y "%temp%\user.conf" "%APPDATA%\AnyDesk\user.conf"
xcopy /c /e /h /r /y /i /k "%temp%\thumbnails" "%APPDATA%\AnyDesk\thumbnails"
rd /s /q "%temp%\thumbnails"
call :start_any
echo *********
echo Completed.
echo(
goto :eof
:start_any
sc start AnyDesk
sc start AnyDesk
if %errorlevel% neq 1056 goto start_any
set AnyDesk1=%SystemDrive%\Program Files (x86)\AnyDesk\AnyDesk.exe
set AnyDesk2=%SystemDrive%\Program Files\AnyDesk\AnyDesk.exe
if exist "%AnyDesk1%" start "" "%AnyDesk1%"
if exist "%AnyDesk2%" start "" "%AnyDesk2%"
exit /b
:stop_any
sc stop AnyDesk
sc stop AnyDesk
if %errorlevel% neq 1062 goto stop_any
taskkill /f /im "AnyDesk.exe"
exit /b
@crocangIt
Copy link

i made it more simplier for me so all my clients remain, no need to delete user.conf in roaming/local.

@echo off
:: Check for administrative privileges
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo Requesting administrative privileges...
    powershell -Command "Start-Process '%~f0' -Verb RunAs"
    exit /b)

echo Killing AnyDesk process...
taskkill /f /im AnyDesk.exe >nul 2>&1

echo Deleting service* and system* files from %ProgramData%\AnyDesk...
del /f /q "%ProgramData%\AnyDesk\service*" >nul 2>&1
del /f /q "%ProgramData%\AnyDesk\system*" >nul 2>&1

echo Starting AnyDesk...
start "" "C:\Program Files (x86)\AnyDesk\AnyDesk.exe"

echo Done.
pause

It worked for me. Thank you.
(Started cmd.exe with admin privileges and pasted your script.)

@digitalonellc
Copy link

digitalonellc commented Jun 2, 2025 via email

@crocangIt
Copy link

Just please dont use anydesk for scams, thats all I ask.

On Mon, Jun 2, 2025 at 4:09 AM crocangIt @.> wrote: @.* commented on this gist. ------------------------------ i made it more simplier for me so all my clients remain, no need to delete user.conf in roaming/local. @echo off :: Check for administrative privileges net session >nul 2>&1 if %errorlevel% neq 0 ( echo Requesting administrative privileges... powershell -Command "Start-Process '%~f0' -Verb RunAs" exit /b) echo Killing AnyDesk process... taskkill /f /im AnyDesk.exe >nul 2>&1 echo Deleting service* and system* files from %ProgramData%\AnyDesk... del /f /q "%ProgramData%\AnyDesk\service*" >nul 2>&1 del /f /q "%ProgramData%\AnyDesk\system*" >nul 2>&1 echo Starting AnyDesk... start "" "C:\Program Files (x86)\AnyDesk\AnyDesk.exe" echo Done. pause It worked for me. Thank you. (Started cmd.exe with admin privileges and pasted your script.) — Reply to this email directly, view it on GitHub https://gist.github.com/janasco/c6168d17ed6eb4b6eaf7fd46fb775f60#gistcomment-5602058 or unsubscribe https://github.com/notifications/unsubscribe-auth/AO6VJAW5KK26QEBVYAR6SZT3BQBFHBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMZYGQ3DCNZRU52HE2LHM5SXFJTDOJSWC5DF . You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

I am not one of those.
I live in the Netherlands and occasionally help my family and friends in Croatia and Canada. Everything is according to the AnyDesk free account policy ('If you are a personal user, the usage of AnyDesk will remain free for you'), but they still sometimes mark me as a professional user.

@SkyVan1eM
Copy link

SkyVan1eM commented Jun 3, 2025

This script i use at my job. and also i would recommend another script that work with multiple scripts and multiple clients:
The idea is to host your scripts at your server or free hosting like hostinger/infinityfree. On your client pc you place a simple script that download actual script that you want to run, that is made so you can perfect your script and it will automaticly work for all, you just change it on your web hosting.
On client:

@echo off
set URL=http://yourhost.com/latest.bat
set FILE=%TEMP%\latest.bat

echo Downloading latest.bat...
powershell -Command "Invoke-WebRequest -Uri '%URL%' -OutFile '%FILE%'"

if exist "%FILE%" (
    echo Running latest.bat...
    call "%FILE%"
) else (
    echo Failed to download latest.bat
)
pause

On server you can place your actual script, like for anydesk or another easy fix. something like just calling calculator will work:

:: Modify as you wish
calc
del %TEMP%\latest.bat

The fact that you can delete the file is greate if they fire you, so u just delete the file on the hosting and they can't use your script, heheh xD

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