-
-
Save janasco/c6168d17ed6eb4b6eaf7fd46fb775f60 to your computer and use it in GitHub Desktop.
@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 |
Works like a charm. Thanks!
Thanks you
Working!. Tnx
Use this to run as admin automatically.
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
@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
Solution to run as admin inside batch file is the solution posted here:
https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
Thank u man
Thanks!
thank you so much worked like a charm. thank you a million times over as i cant afford to pay for any desk my currency is total crap
My hero of the day !
greetings and thank you very much
Does it still work for 2025?
How save the file: AnyDesk-Reset.cmd or AnyDesk-Reset.bat?
thank you
My hero of the day !
hi!!! How save the file: AnyDesk-Reset.cmd or AnyDesk-Reset.bat?
My hero of the day !
hi!!! How save the file: AnyDesk-Reset.cmd or AnyDesk-Reset.bat?
Save as .bat file and run as administrator
Stopped working, I have use it today and deleted all my previous and saved clients...
Linux instructions:
#use ifconfig to determine your wlan interface and use below to set random and burned in
sudo ifconfig wlp2s0 down
sudo apt -y install macchanger
sudo macchanger -r -b wlp2s0
sudo ifconfig wlp2s0 up
rm -rf ~/.anydesk
sudo apt autopurge anydesk -y
sudo apt -y install anydesk
#save to /sbin/resetanydesk then chmod +x /sbin/resetanydesk and run resetanydesk
This will wipe your settings and hosts, if you want to save them:
mv ~/.anydesk ~/.anydesk.old
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
Worded
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.)
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.
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
Good script, thank you very much!