8

I have set up Mosquitto MQTT on my Windows 7 laptop. I have performed the installation process according to this step by step guide.

Installation was alright and I could start the Mosquitto Broker's service by using C:\Windows\system32\services.

windows service overview showing mosquitto broker service


Now what I want is to be able to launch the service from Windows 7 command prompt. In everycase I tried to run the commands from the install directory of Mosquitto (D:\..\MQTT\mosquitto>).

  1. First I have tried the following command according to the documentation:

    mosquitto -d
    

    -d, --daemon

    Run mosquitto in the background as a daemon. All other behaviour remains the same.

    Turned out that I cannot do this on Windows.

    1483193297: Warning: Can't start in daemon mode in Windows.
    
  2. After, I have tried a command shared on this site.

    mosquitto –p 1883 –v
    

    This one started the broker but not the background service. I have checked the service among the Windows services, and Mosquitto Broker was not started.


Does anyone know the proper way of starting Mosquitto broker's service from Windows 7 command prompt?

1 Answer 1

9

I finally succeeded in finding the correct command on this site. It is:

net start mosquitto

It can be run from any directory. If you receive the following error:

D:\..\MQTT\mosquitto>net start mosquitto
System error 5 has occurred.

Access is denied.

then you need to run the command prompt as an administrator. In case of success the following response will be shown.

D:\..\MQTT\mosquitto>net start mosquitto
The Mosquitto Broker service is starting.
The Mosquitto Broker service was started successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.