What is the purpose of the RunAsCommand value?

Raymond Chen

Raymond

Commenter c_e_pizano asks what the purpose of the HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\foo.exe\RunAsCommand registry value is.

Well, for starters, it isn’t documented, so the official answer to that question is “Don’t mess with it.”

Kind of makes me wonder why you’re asking about the registry value anyway, seeing as it’s undocumented in the first place. Are you trying to reverse-engineer Windows?

To be honest, I don’t know what its purpose is, but I do know what happens when you set it: Everything stops working.

This is one of those abandoned features like EM_SETHILITE. When it got abandoned, not all of the pieces got cleaned up, and there is still code that queries for the key, but the code path that gets executed when the query succeeds simply doesn’t work (probably because some of the functionality it relied upon was deleted!) and consequently always returns an error. That’s why, if you set the value, you get a weird error message.

The broken code was deleted in 2004, so Windows Vista doesn’t even query for the value any more. It’s now just a footnote to history.

0 comments

Comments are closed.