I've setup a sshd as a service on windows 7 with cygwin, choosing to create cyg_server to run it. Now I can login to my machine via SSH with my normal username, everything works, except what depends on the USER environment variable PATH.
In Windows the user PATH is appended to the system PATH, and this works also in a cygwin shell opened locally, but not when logging in through ssh.
Inspired from How to update the PATH user environment variable from command-line, I tried
MYPATH=$(reg query HKEY_CURRENT_USER\\Environment /v PATH)
but then I still need to parse the req query response, convert the dos path separator ; to : , and use cygpath to convert back slash to forward slash. (not to mention more complex cases with space in names and variables to expand).
What is cygwin doing locally in Windows to set the path correctly, that is not doing in ssh?