dragonscave.space is one of the many independent Mastodon servers you can use to participate in the fediverse.
A fun, happy little Mastodon/Glitch instance.

Server stats:

242
active users

Obscure question: After restarting explorer.exe, is there a way to force it to refresh environment variables from the registry? Or, a way to restart Explorer in a way that it picks up the latest ones from the registry on its own, rather than from when I last restarted the computer which was... ahem... December.

James Scholes
Public

The answer is yes. Quit Explorer, run cmd from Task Manager, do a refreshenv command, then start Explorer from cmd instead of Task Manager. Will there be unintended side effects of starting my shell from a command prompt that is now closed? Who knows.

Jayson Smith
Public

@jscholes This must be Windows 11, as my Cmd in Windows 10 doesn't know what refreshenv is.

James Scholes
Public

@jaybird110127 Hmm. It is Windows 10, so that's a bit of a mystery.

Andre Louis
Public

@jscholes @jaybird110127 I'm also in win10 and typed 'refreshenv' to see what happened, and it happened just fine.

James Scholes
Public

@jaybird110127 Ah, looks like that command comes from having Chocolatey installed.

Devin
Public

@jscholes good ol' windows

Andre Louis
Public

@jscholes Nah, shouldn't be, just typing 'start explorer' is usually fine to close the shell after.

James Scholes
Public

@simon Having said that: If I restart Explorer from a Task Manager instance that I launched from the Run dialog, the new Explorer process also gets an outdated environment. So it's possible that Task Manager creates processes in such a way that causes them not to inherit Task Manager's own environment.

Simon Jaeger
Public

@jscholes I wonder if the ctrl alt delete / alt+t task manager is any different since that's launched by something on the secure screen.

Simon Jaeger
Public

@jscholes That's really strange, because if I update the environment and relaunch cmd, it seems to handle that just fine. I've never experienced being stuck with an outdated environment. But when I think about the way Windows passes the environment onto subprocesses, I now have no idea why. Your scenario seems like what should happen, it's just definitely not what happens here. There is a registry hack to automatically run a batch file when cmd starts, so you could always do that as a permanent fix. I used this to add aliases, because I couldn't find a better way.

James Scholes
Public

@simon If you don't restart Explorer between updating the environment and launching cmd, the results you're seeing are expected. Windows sends appropriate messages to applications to let them know the environment has changed, and Explorer seems to take notice of those.

James Scholes
Public

@simon Or to put it another way, the following works fine: Update environment, launch cmd, use new environment. What doesn't work is: Update environment, restart Explorer, launch cmd, use new environment.

Simon Jaeger
Public

@jscholes That seems very counterintuitive because if explorer receives the message about the updated environment, shouldn't it pass it onto taskmgr, which would pass that onto the new explorer?

James Scholes
Public

@simon Sure. Hence my comment that taskmgr must create processes in such a way that results in them not receiving taskmgr's environment at all. Maybe for security, maybe by accident.

Florian
Public

@jscholes huh. I think my record for days without reboot is like 47 or so, usually around the 30-40 mark random things start getting really odd

ZeStig :emacs: :archlinux: :rust: :gnu: :nix:
Public

@zersiax @jscholes meanwhile #linux servers casually not needing a reboot in months 😂