Windows Service Error 87, "The parameter is incorrect" when starting a service

Error 87 when starting a service means Windows was given a bad parameter, usually a malformed service path, a mistyped sc command, or a corrupted parameter in the service registry key.

The fix, in order

  1. Check the binary path. Run sc qc followed by the service name in an admin Command Prompt and read the BINARY_PATH_NAME line. A path with spaces that is not wrapped in quotes, or a path with a stray character, causes this error.
  2. Fix the path quoting. A service path that contains spaces must start and end with a quote, like "C:\Program Files\Vendor\service.exe". If the quotes are missing or mismatched, reinstall the program to rewrite the path correctly.
  3. Check your own sc commands. The sc tool needs a space after every equals sign, like sc config with the service name and start= auto. Without the space, it reports error 87.
  4. Check the service parameters in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ and the service name, then Parameters. A value left behind by an old version can pass a bad parameter at startup. Back up the key before changing anything.
  5. Reinstall the program that provides the service. A clean install writes a correct binary path and parameters.
  6. Run sfc /scannow in an admin Command Prompt if the service is a Windows service, since a damaged system file can also surface as error 87.

If it still happens

If the error only appears when a script starts the service, check the exact command the script runs. A missing quote or a wrong switch in the script is the usual cause, and the Services console can start the same service without trouble.

Common questions

Why does sc config keep giving me error 87? Because sc needs a space after the equals sign, like start= auto. Writing start=auto with no space is the most common cause of error 87 from the command line.

What is a bad parameter for a service? Usually the binary path or a startup parameter. A path with unquoted spaces, a switch the program does not recognise, or a leftover registry value can all be the bad parameter Windows is complaining about.

Related errors

Windows Service Error 2 · Windows Service Error 3 · Windows Update Error 0x80070057

Was this helpful?