February 9th, 2009

What is the purpose of the RunAsCommand value?

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.

Topics
History

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.