2. Using the Command Prompt:
You can add dependencies to Windows Services via the Command Prompt. Here are the steps:
- Right-click on the Command Prompt icon and select Run as administrator to open the Command Prompt with the required permissions.
- Type the following command in the Command Prompt:
sc config <Service_Name> depend= <Dependency_Name>
- Replace <Service_Name> with the name of the service you want to add a dependency to, and <Dependency_Name> with the name of the service you want to add a dependency to.
Usage Examples
For example, if you want to add Tcpip and Afd as dependencies for a service named MyService, you would type the following command:
sc config MyService depend= Tcpip/Afd
Important Notes
Make sure there is a space after the equals sign (=) in the command.
Adding a new dependency will overwrite the existing list of dependencies. So, if MyService previously had another service as a dependency, after running this command, only Tcpip and Afd will be the new dependencies.
To see a list of existing dependencies, use the command:
sc qc <Service_Name>
By following these steps, you can easily add dependencies to Windows Services using the Command Prompt.
Other Interesting Articles
3. Restart the Service to Apply Changes:
After adding dependencies to a Windows service, the next step is to restart the service for the changes to take effect. Here are two ways to restart the service:
Using the Command Prompt
You can use the net stop and net start commands to restart the service through the Command Prompt.
Steps:
- Open the Command Prompt with administrator privileges.
- Type the following command to stop the service:
net stop <Service_Name>
Replace <Service_Name> with the name of the service you want to discontinue.
- After the service is stopped, type the following command to restart the service:
net start <Service_Name>
Using Services Manager
You can also restart the service through the Services Manager.
Steps:
1. Press Win + R to open the Run dialog.
2. Type services.msc and press Enter.
3. Find the service you want to restart in the list.
4. Right-click on the service name and select Restart.
Make sure all required dependencies are active before restarting the main service.
Restarting the service will apply all the changes that have been made, including the addition of new dependencies so that the service can function properly according to the latest settings.