Command Line Interface

Advanced users can control AnyDesk from scripts using the command line. For some cases AnyDesk uses the pipe mechanism of the operating system instead of parameters for higher security.

Note: This works for Windows and Linux (partially) as of now.

See also: Exit Codes, Automatic Deployment


Overview

Parameter Description
--file-transfer Start the file transfer session (used after the destination address).
--control Start the process which creates the tray icon. During installation, AnyDesk creates a link with this parameter in the autostart start menu entry.
--start-service Start the AnyDesk service, if not already running.
--stop-service Stop the AnyDesk service.
--restart-service Restart the AnyDesk service.
--register-license Register a license key with AnyDesk.
--set-password Set a password for unattended access.
--with-password Read the password from stdin and connect to the alias given in the command line using the password.
--get-alias Get the current AnyDesk Alias.
--get-id Get the current AnyDesk ID.
--get-status Return the network status of AnyDesk (online or offline).
--silent AnyDesk will not display message boxes when this parameter is specified. Recommended for scripts.
--remove Uninstall AnyDesk with no notice (silent uninstall).


For installation parameters, see Automatic Deployment.

Get Alias, ID or Status

Note: The AnyDesk service must be running. On Windows, use these commands via batch scripts.

AnyDesk writes requested information to stdout. If the service is not running, SERVICE_NOT_RUNNING is returned and an exit is set indicating the error. If AnyDesk is not installed, it needs to be started first, in order to launch a local service.

On Linux, get AnyDesk Alias or ID of the installed and running AnyDesk, with this syntax:

anydesk --get-alias

anydesk --get-id

anydesk --get-status

Use batch scripts for Windows:

to get ID:

@echo off
for /f "delims=" %%i in ('"C:\Program Files (x86)\AnyDesk\AnyDesk.exe" --get-id') do set CID=%%i 
echo AnyDesk ID is: %CID%
pause

to get Alias:

@echo off
for /f "delims=" %%i in ('"C:\Program Files (x86)\AnyDesk\AnyDesk.exe" --get-alias') do set CID=%%i 
echo AnyDesk Alias is: %CID%
pause

to get status:

@echo off
for /f "delims=" %%i in ('"C:\Program Files (x86)\AnyDesk\AnyDesk.exe" --get-status') do set CID=%%i 
echo AnyDesk status is: %CID%
pause

Connecting with Password (only works for Windows)

Example script that connects to alias@ad with password. Use command line or batch script:

echo password | "C:\Program Files (x86)\AnyDesk\AnyDesk.exe" alias@ad --with-password


Automatic Execution (script/MSI)

AnyDesk is installed by script with the following command:

anydesk.exe --install <location> --start-with-win

Important:

<location> must be a valid installation path, e.g. c:\anydesk. Currently, AnyDesk must be started with Windows.

For more installation parameters, see Automatic Deployment.

Setting a Password

For security reasons, a password for unattended access can not be set from the command line directly as this would enable malicious users to spy the password from the command line in Task Manager. Instead, a pipe is used to set the password.

echo password | anydesk.exe --set-password

standard client: echo my_new_password | anydesk.exe --set-password

custom client: echo my_new_password | anydesk-123abc456.exe --set-password

This requires administrator privileges.

Registering License Key

You can register a license with the current AnyDesk installation using the command line. The service must be running.

echo license_keyABC | anydesk.exe --register-license

Almost every scripting language has a pipe interface for stdin and stdout. See the programming language documentation for more information.

Other Command Lines (only work for Windows)

Parameter Description
--tray Start the process which creates the tray icon.
--show-settings Show the setting page
--admin-settings Open admin settings
--conn-settings Open connection settings
--cap-settings Open security settings
--global-rec-settings Open global recording settings
--show-advert Show the advertisement page of AnyDesk. Thank you for sharing! :)
--disclaimer Show your customized disclaimer