github.com/KyaXTeam/consul@v1.4.5/website/source/docs/guides/windows-guide.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Windows Service"
     4  sidebar_current: "docs-guides-windows-service"
     5  description: |-
     6    By using the _sc_ command either on Powershell or 
     7    the Windows command line, you can make Consul run as a service. For more details about the _sc_ command
     8    the Windows page for [sc](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx)
     9    should help you get started.
    10  
    11  ---
    12  
    13  # Overview
    14  By using the _sc_ command either on Powershell or 
    15  the Windows command line, you can make Consul run as a service. For more details about the _sc_ command
    16  the Windows page for [sc](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682107(v=vs.85).aspx)
    17  should help you get started.
    18  
    19  Please remember to create a permanent directory for storing the configuration files. It is always
    20  advisable to start Consul with the _-config-dir_ option.
    21  
    22  The steps presented here , we assume that the user has launched Powershell with _Adminstrator_ capabilities.
    23  
    24  ## Running Consul run as a service on Windows
    25  
    26  ### Installing Consul as a Service
    27  
    28  Download the Consul binary for your architecture.
    29  
    30    Use the _sc_ command to create a Service named **Consul**, which starts in the _dev_ mode.
    31  
    32     ```text
    33     sc.exe create "Consul" binPath="Path to the Consul.exe arg1 arg2 ...argN"
    34     [SC] CreateService SUCCESS 
    35     ```
    36     
    37     
    38     If you get an output that is similar to the one above, then your service is
    39     registered with the Service manager. 
    40     
    41     
    42     If you get an error, please check that
    43     you have specified the proper path to the binary and check if you've entered the arguments correctly for the Consul
    44     service.
    45  
    46  
    47  ### Running Consul as a service
    48  
    49  You have two ways to start the service.
    50  
    51  * Go to the Windows Service Manager, and look for **Consul** under the 
    52    service name. Click the _start_ button to start the service.
    53  * Using the _sc_ command:
    54     
    55       ```text
    56       sc.exe start "Consul"  
    57       
    58       SERVICE_NAME: Consul
    59              TYPE               : 10  WIN32_OWN_PROCESS
    60              STATE              : 4  RUNNING
    61                                      (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
    62              WIN32_EXIT_CODE    : 0  (0x0)
    63              SERVICE_EXIT_CODE  : 0  (0x0)
    64              CHECKPOINT         : 0x0
    65              WAIT_HINT          : 0x0
    66              PID                : 8008
    67              FLAGS              : 
    68       ```
    69  
    70  The service automatically starts up during/after boot, so you don't need to
    71  launch Consul from the command-line again.