-
-
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 |
Good script, thank you very much!
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
Espetacular, Parabéns pelo trabalho.