Fix 'Error 2: The system cannot find the file specified' When Starting Windows Service

intermediate๐ŸชŸ Windows2026-05-09| Windows 10, Windows 11, Windows Server 2016/2019/2022 โ€” any Windows Service (custom, third-party, or built-in)

Error Message

Windows could not start the service on Local Computer. Error 2: The system cannot find the file specified.
#windows#service#registry#sc

TL;DR

The service's executable path in the registry is wrong โ€” it points to a file that no longer exists. Find the correct path, update it with sc config, restart the service.

sc config "YourServiceName" binpath= "C:\correct\path\to\service.exe"
sc start "YourServiceName"

What's Actually Happening

Every Windows service stores its executable path in the registry under:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<ServiceName>\ImagePath

When Windows throws Error 2: The system cannot find the file specified, the Service Control Manager (SCM) tried to launch that executable and got back Win32 error code 2 โ€” ERROR_FILE_NOT_FOUND. The binary is missing, moved, or the registry path was never correct to begin with.

Here's how it typically happens:

  • You reinstalled an app to a different drive or folder, but the service entry wasn't updated
  • A partial uninstall removed the binary but left the service registration behind
  • The service was registered manually with a typo in the path
  • Antivirus or a cleanup tool quietly deleted the executable
  • You're deploying a custom service and the installer dropped files in the wrong location

Step 1 โ€” Identify the Broken Path

Start by getting the service name (not the display name โ€” they're different). Open an elevated Command Prompt and run:

sc query type= all state= all | findstr /i "SERVICE_NAME DISPLAY"

Already know the name? Query it directly:

sc qc "YourServiceName"

Spot the BINARY_PATH_NAME line in the output:

[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: YourServiceName
        TYPE               : 10  WIN32_OWN_PROCESS
        START_TYPE         : 2   AUTO_START
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : C:\Program Files\OldApp\service.exe
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : Your Service
        DEPENDENCIES       :
        SERVICE_START_NAME : LocalSystem

Now verify whether that path actually exists on disk:

dir "C:\Program Files\OldApp\service.exe"

File Not Found? That's your culprit.

Step 2 โ€” Track Down the Binary

Search the entire C drive for the executable name:

where /r C:\ service.exe 2>nul

PowerShell is faster on large drives:

Get-ChildItem -Path C:\ -Filter "service.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object FullName

Nothing comes back? The file is genuinely gone โ€” reinstall the application before going further. If it shows up somewhere else, note the new path and move to Step 3.

Step 3 โ€” Fix the Service Path

Option A: Using sc config (fastest)

Update the path in one command. That space after binpath= is mandatory โ€” skip it and sc will silently fail:

sc config "YourServiceName" binpath= "C:\NewPath\to\service.exe"

Running a Java service or .NET worker that takes arguments? Escape the inner quotes like this:

sc config "YourServiceName" binpath= "\"C:\path\to\service.exe\" --arg1 value"

Option B: Edit the Registry Directly

Open regedit and go to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourServiceName

Double-click ImagePath and paste in the correct path. For binaries that take arguments:

"C:\path\to\service.exe" --flag value

Kernel drivers and system services often use environment variables โ€” keep them intact rather than expanding to a hard path:

%SystemRoot%\System32\yourdriver.sys

Option C: Using PowerShell

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\YourServiceName" `
  -Name "ImagePath" `
  -Value '"C:\correct\path\to\service.exe"'

Step 4 โ€” Start the Service and Verify

sc start "YourServiceName"

Check it's running:

sc query "YourServiceName"

You want STATE : 4 RUNNING in the output. Or use PowerShell:

Get-Service -Name "YourServiceName" | Select-Object Name, Status, StartType

Edge Cases That Catch People Off Guard

Quoted paths with spaces

Any path with spaces must be wrapped in quotes inside ImagePath. Without them, SCM splits on the first space and tries to find a binary at something like C:\Program โ€” which obviously fails:

# Wrong โ€” breaks on the space before "Files"
sc config "MySvc" binpath= C:\Program Files\App\svc.exe

# Correct
sc config "MySvc" binpath= "\"C:\Program Files\App\svc.exe\""

Service runs as a specific user account

When a service runs as a domain or local account (not LocalSystem), that account needs read and execute permission on both the binary and its parent directory. Check with:

icacls "C:\path\to\service.exe"

The service is a kernel driver

Drivers live under %SystemRoot%\System32\drivers\. A missing driver file means running the installer again or re-extracting the driver package โ€” pointing ImagePath to an arbitrary location won't work for drivers.

Just want the dead service gone?

If the app is already uninstalled and you only want to clean up the ghost entry:

sc delete "YourServiceName"

It won't vanish from Services MMC immediately โ€” either reboot or wait for SCM to refresh.

Verify the Fix Persists After Reboot

For auto-start services, confirm the path survives a restart cycle:

sc qc "YourServiceName" | findstr START_TYPE
# Should show: AUTO_START or DEMAND_START

# Simulate a restart-triggered start
sc stop "YourServiceName"
sc start "YourServiceName"
sc query "YourServiceName"

Still seeing errors? Open Event Viewer:

eventvwr.msc

Go to Windows Logs โ†’ System and filter by Source: Service Control Manager. The full error history for your service will be there, often with more detail than the command line gives you.

Related Error Notes