Command to Stop or Restart Octoprint in Windows

Continuing the discussion from Setting up OctoPrint on Windows:

I successfully installed OctoPrint on Windows, following Gina's instructions and Python's 3.9.
I'm able to access the server and connect to the printer, everything good.
I installed then a plugin for Bed Leveling and I'm not able to see it in Octoprint in plugins.
I suppose I have to restart Octoprint in order to be able to see the plugin.
I'm wondering what is the procedure (or Command) that I can use (in Windows) to Stop or Restart Octoprint only?

In the top navbar, you should have some icons.

One is for the system:

grafik

These don't show up in windows installs by default. I personally created a batch file to kill octoprint and then start it back up, I create a batch file in the venv\Scripts folder named restart and then in OctoPrint's settings put in the full path to that bat file.

@if octoprint.==. (goto error) ELSE (goto restart)

:restart
@taskkill /f /im octoprint.exe >nul
@timeout /t 3 /nobreak >nul
@start octoprint.exe serve >nul
@echo restart complete
@goto exit

:error
@echo Oops... something went wrong!
@goto exit

:exit
@echo off
for /F "tokens=2" %%i in ('date /t') do set mydate=%%i
set mytime=%time%
@echo Completed at %mydate%:%mytime%
3 Likes

I have searched the entire internet for this. Thank you very much!

Do you have a shutdown .bat file code you could share?

This line should be the only thing necessary for shutting down.

I stumbled on this today and after hours of searching found that the solution is easier than everyone thinks.
jus to to octoprint/settings/server and enter the commands. This will make the icon show up!

1 Like

These are Linux commands you have, this thread is called 'Command to Stop or Restart OctoPrint on Windows'.

best i can help with is this. works form powershell

taskkill /im octoprint.exe /f ; Start-Sleep -Seconds 10; & "C:\OctoPrint\venv\Scripts\octoprint.exe" 
PS C:\Users\valer> taskkill /im octoprint.exe /f ; Start-Sleep -Seconds 10; & "C:\OctoPrint\venv\Scripts\octoprint.exe"
SUCCESS: The process "octoprint.exe" with PID 8776 has been terminated.
Starting the server via "octoprint" is deprecated, please use "octoprint serve" from now on.
2024-01-18 19:50:40,786 - octoprint.startup - INFO - ******************************************************************************
1 Like