Is there a tool in Windows that will dump all of a process context to debug these kind of things: CWD, env vars, current user, elevation, etc.
Process Explorer (Sysinternals) and System Informer both provide access to this info. There are powershell commands that will allow you to inspect it too.