getenv("PATH");
It will retrieve the system path and user path together.
You need to use Windows registry mechanism to find out user and system path separately. To access them, read the value of PATH
from two different positions in the registry:
User variables:
HKEY_CURRENT_USER\Environment
System variables:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment