Path environment variable while running a Windows service under a user account

Viewed 284

I am running a Windows service (I cannot modify) under a given user account. The service does a few things, among them runs a bat script that I should provide.

I discovered that the PATH variable available to the service (as seeen by Sysinternal Process Explorer) is the user PATH environment variable. The default is %USERPROFILE%\AppData\Local\Microsoft\WindowsApps which limits the available command in the script to the built-in cmd commands. I need to have a few more path, as when using cmd where the PATH is the merge of user PATH and system PATH.

Short of changing the user PATH variable and adding part of or all system PATH, is there a way to change user PATH variable that would be seen by the Windows service?

I found a suggestion about editing the registry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourService in order to add a PATH environment variable. While it could be the solution I was looking for, unfortunately it did not work. Any suggestion ?

0 Answers
Related