How to obtain a ‘desktop’ cmd.exe subshell environment when SSH’ed into cygwin

cygwin;environment-variablesssh

I've successfully configured SSH under cygwin, so I can SSH into my windows user account and land at a bash shell in cygwin. This is great.

However, I have a python program that I'd like to run in this environment (I'll be running the Windows, not cygwin python) that expects many of the standard windows environment variables to be available. But if I start cmd.exe from within the cygwin bash shell I get a cmd.exe environment that is populated with a mix of cygwin-esque values (MANPATH, LOGNAME) and a subset of the windows-esque environment variables: It has ALLUSERSPROFILE and COMPUTERNAME, for instance, but many variables that I would typically see if I launched a command prompt window from the windows desktop are missing: PROCESSOR_ARCHITECTURE, NUMBER_OF_PROCESSORS, etc.

The program that I'd like to run from my SSH session (SCons) relies on these values, and several others. Is there any way to, within the SSH session, launch cmd.exe as subshell that will obtain a 'command prompt launched from the desktop' like environment?

I very much do not want to explicitly need to set all of the potentially necessary values myself as such a solution is quite fragile. I'm looking for an automatic mechanism.

Is there any mechanism by which I can obtain a 'desktop cmd.exe environment' from within a cygwin SSH session?

Best Answer

I take it the env vars you are missing are your user vars. By default, Cygwin only imports system vars when the shell is launched via SSH. You can try the solution linked to in this answer here to get Cygwin to import your user vars when launching via SSH.

Related Question