Problem installing openHAB as a service in windows

  • Platform information:
    • Hardware: 64 bit/32gb
    • OS: Windows 11
    • Java Runtime Environment: 17.0.8
    • openHAB version: 4.0.3
  • Issue of the topic:

Hi, I’m trying to install openHAB as a service on my windows laptop.
Everything is working fine until this step:
https://www.openhab.org/docs/installation/windows.html#:~:text=Open%20an%20elevated%20command%20prompt%20and%20type%20the%20following%20commands%3A

When I use this command:
C:\openHAB\userdata\bin\openHAB-service.bat install
I get this error:
The system cannot find the path specified.

I’ve checked and the path is correct

Can anyone help with this?
Thanks

The path is correct, and the .bat file is located inside of the last folder?

Hi
Welcome to the openHAB community!
I just walked through a entire build of openHAB 4.0.3 on windows 10 from scratch and added it as a service and it worked fine for me.
I even used a folder above c drive my install was to c:\hold\openhab4

(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>cd c:\hold\openhab4\userdata\bin

c:\hold\openhab4\userdata\bin>openHAB-service.bat install
wrapper  | openHAB installed.

c:\hold\openhab4\userdata\bin>net start "openHAB"
The openHAB service is starting.........
The openHAB service was started successfully.


c:\hold\openhab4\userdata\bin>`

This is a pretty straight forward activity.
I doubt it is going to be any different on windows 11.
Make sure you opened an administrator command prompt and then cd all the way to the bin folder then run the command. only thing I can think you did not do is open the administrator command prompt.
Double check that and make sure you are also in the bin folder when you run the command and let us know (maybe a screen shot of what you are doing will help also).
If you still have trouble let us know and I will try and find some time to build a windows 11 VM and do the install on windows 11 as well just to verify.

Hi, yes my path is correct and the .bat file is located inside of the last folder.
I’m using a different path:
“C:\ExtraPrograms\openHAB\userdata\bin”
(I just mentioned the other path to simplify troubleshooting)

Hi,
Thanks for the detailed troubleshooting.
My actual path is:
“C:\ExtraPrograms\openHAB\userdata\bin”

When I cd into it and run
openHAB-service.bat install
I get the message:
The system cannot find the path specified.

And when I run just
openHAB-service.bat
I get this message:

Usage:  karaf-service ( commands ... )
commands:
  run               Start openHAB in the current console
  install           Install openHAB as a Windows service
  remove            Remove the openHAB Windows service

Which proves the .bat file exists at the location.

Hi,
I successfully installed the service.
Thank you for your help.

The problem was that I had renamed the “Extra Programs” folder to “ExtraPrograms” to get rid of the space and that had caused problems.

A simple restart of the computer caused the old “Extra Programs” folder to reappear.
Transferring the open hab files to this folder solved the problem.

Thanks again