Change Executable Path of Services in Windows 11 Pro

Introduction

All Windows service running on the computer has their own executable path called binPath. Here in this article Change Executable Path of Services in Windows 11 Pro, we would demonstrate how to change the path of executable (binPath) of a Windows service using a Computer Registry and Command Prompt.

windows services computer registry command prompt
Change Executable Path of Services in Windows 11 Pro

Getting Started

As a developer, everyone must have worked with Windows service. When a Windows service is installed, the information (like the location of services in the computer etc.) of the services is stored in the computer registry. That path can be changed using the Registry Windows and Command Prompt. In below we will demonstrate how to change the executable path using both mentioned approaches.

We will discuss here the SQL service which I installed during the window installation. Note that during the demonstration do not change the path other wise you will get into trouble.


Change Executable Path of Services Using Registry Editor

The following steps will guide you in checking registry to see/ change the executable path of the SQL service.

  1. Press Windows+ 'R' key at a time, the run window will be open then type 'regedit'.
  2. Or in search type 'registry editor'.
  3. The Registry Editor window will be open then find the 'HKEY_LOCAL_MACHINE' and expand it.
  4. Go to the system=> CurrentControlSet=>Services key.
  5. Find the name of your Windows service whose executable path you want to change and select, here we will see the path of SQL Angen, hence I have selected the SQLAgent$SQLExpress.
  6. On the right pan, you will get different keys, find the ImagePath and double-click on it.
  7. The ImagePath is the path of the executable file of services. here you can change your service location.
executable path registry windows

Change Executable Path of Services in Windows 11 Pro


Change Executable Path of Services Using Command Prompt

The above steps helped to see/ change the executable path of services, following steps will guide you to change the executable path of SQL service using cmd commands.

  1. Run the command prompt in admin mode.
  2. To run the command prompt type 'cmd' in the window search field and click 'Run as administrator'.
  3. Run the sc command in the command prompt.
  4.  //Syntax   
     sc config <service name> binPath= <binary path>  
    
  5. Replace the <service name> with your service name.
  6. Replace the <binary path> with the path of your executable files.
  7. Examples;-
  8.  sc config SQLAgent$SQLEXPRESS binPath="C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Binn\SQLAGENT.EXE" -i SQLEXPRESS"  
    
  9. using the qc sc command, we can see the current configuration of the window service also. Syntax
  10.  sc qc <Service Name>  
    
  11. Example:-
  12.  sc qc SQLAgent$SQLEXPRESS  
    
sc command cmd command prompt

Change Executable Path of Services in Windows 11 Pro

It's also probably a bit nicer in a deployment script than the direct registry modification approach. I would recommend this approach over direct registry changes.

Thanks

Kailash Chandra Behera

An IT Professional with 12 years experience in development life cycle in windows, service and Web based application using Microsoft.Net technologies. Proven record of developing all phases of projects in Microsoft.Net technology from initiation to closure aligning with the company's Business objectives to drive process improvements, competitive advantage and bottom-line gains. -> Good exposure of independently working and developing multiple projects ->Committed to efficient and effective development of projects in a fast-paced and deadline driver environment. Skill :- Develop and design projects in various technologies of Microsoft Technology. Total IT Experience- 13+

Previous Post Next Post

نموذج الاتصال