Setting %PATH% for a service?

17,016

The offending directory is specified either in the system-wide PATH environment variable, or in the Local System user's personal environment variables.

The Local System user's personal environment variables are specified at HKEY_USERS\.DEFAULT\Environment. The machine-wide environment variables are specified at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. The former isn't really easily accessible from anywhere except the registry, but the latter is accessible from the Environment Variables dialog on the Advanced tab of the System Properties.

Share:
17,016

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I have a service which is installed that runs and executes certain commands periodically. It runs as the Local System account. The source code for the service is not under my control, but I do control the Windows XP SP3 box that the service is on.

    Recently, changes were made to the system that put a certain path at the forefront of the %PATH% for this service. One of the executables in that path has the same name as one of the commands my service uses, so the service mistakenly uses the wrong executable.

    I need to change things back so that my service executes the right command. How do I modify the %PATH% so that the service will see it? I've already tried setx -m ... but with no luck.

  • Álvaro González
    Álvaro González over 5 years
    Such PATH items appear to be appended at the end of the system-wide ones.