0

I want to edit the start type from a service with command prompt.

For example delivery-optimisation-service :

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InstallService\DoSvc

My goal is to create a bat file that will allow me to set the start value from the service.

Value 4 for disabled and value 3 for manually.

I guess the command must look similar to this:

reg edit HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InstallService\DoSvc \Start \value_4

Obviously this command is wrong, anyone please let me know what the correct command is?

ZygD
  • 2,577

2 Answers2

0

There is no reg edit command, you should use the documented reg add:

reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\InstallService /v Start /t REG_BINARY /d 4
harrymc
  • 498,455
0

To set the value to 4 try this code. The net session part makes sure the batch runs as admin since you need admin rights to change the value. Also you would have to use the /f switch so the command doesn't ask for confirmation if you want so override the existing value.

@echo off
net session >nul 2>&1 || (powershell start -verb runas '"%~0"' &exit /b)

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DoSvc" /v Start /t reg_dword /d 4 /f