How to Use the Command Line to Force Stop a Stuck Windows Service

Sometimes when a windows service does not behave as expected, a restart of the service is required. This is easily done in the ‘Service’ window, by right clicking on a particular service and then left clicking on ‘Restart’. After doing this, usually the service will restart, but if the service is stuck at ‘Stopping’, a ‘taskkill’ command can be used to force stop the service.

In the example below, a Matrikon Tunneller CSC service is stuck at ‘Stopping’.

Example of a Windows Service stuck at ‘Stopping’

To ensure the taskkill command run successfully the command window will need to run as an administrator user. Right click on the Command Prompt icon and click on ‘Run as administrator’.

Run the command windows as administrator user

The taskkill command format is:

taskkill /pid <PID> /f

Where the <PID> is the process ID which is displayed in the ‘PID’ column in the task manager. The ‘/f’ parameter specifies to forcefully terminate the task/process. Enter the command as per the example below and then press enter.

The taskkill command

A “SUCCESS” message will be displayed.

‘taskkill’ command successful

Verify in task manager of services window that the service has stopped.

Service stopped

Leave a Comment