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.

Comments (20)
  1. Dog says:

    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?

    Yes.

  2. John says:

    Is it just me, or does anyone else have a sudden urge to fire up Windows 2000 and try to figure out what that registry value does?

  3. DWalker says:

    I have NO desire to fire up Windows 2000.  It was a good operating system for its time, but XP and Windows 7 are so much better that I don’t want to look at 2000 any more!

  4. Caliban Darklock says:

    He’s probably trying to solve a weird problem he doesn’t understand.

    Whenever something weird happens, and I don’t have a clear idea of what might cause that, I go and look at several likely places that could cause something weird. The registry is one of those places. So something weird happened, and I don’t understand it, and I’m looking in the registry. And there’s this key, and it seems weird, and I can’t find any documentation on it. A weird key might cause a weird error, right?

    And DWalker59, what about Vista? It’s awesome.

  5. John says:

    Windows 2000 is still a good operating system today.  While XP is a nice improvement (particularly SP2), I wouldn’t say it is "so much better".

    Tonight I’m going to research this stupid RunAsCommand registry value and see if I can’t satisfy my curiosity.

  6. Neil (SM) says:

    >>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? <<

    Paranoid much?  ;)

    [If you’re trying to reverse engineer Windows, then I don’t want to help you violate the license agreement. -Raymond]

    @Darklock: I’m starting to tell folks that Windows 7 is like Vista with more positive press coverage.

  7. JamesNT says:

    It’s one thing to play with little details like this on your test machine at home because you are a gear-head and you enjoy seeing what happens next.  The problem I have with these situations is that there are people out there using undocumented details such as this IN THEIR PRODUCTION ENVIRONMENT.  And when things break, they blame MS and scream to the EU about how MS has undocumented API’s and is guilty of anti-trust.

    JamesNT

  8. someone else says:

    @Caliban: This sounds a lot like the Politician’s Fallacy:

    1. Something must be done.

    2. This is something.

    3. Therefore, it must be done.

  9. porter says:

    > I have NO desire to fire up Windows 2000…. but XP and Windows 7 are so much better that I don’t want to look at 2000 any more!

    My ThinkPad 390 and I don’t agree. :)

  10. jasond says:

    Agree, a little paranoid. It could just be simple curiosity.

  11. Ken Hagan says:

    The question was probably inspired by seeing the request being made in some registry spying tool. Fortunately for those wishing to discourage tinkering with undocumented details, this particular option breaks everything in older versions of Windows and simply doesn’t exist in newer ones. Result!

  12. DCMonkey says:

    I don’t have that particular value in my XP registry, but I do have "RunAsOnNonAdminInstall" set to 1 for install.exe and setup.exe.

    My WAG is that RunAsCommand is/was for setting default command line options to pass to the runas command when automatically using runas on a program listed in "app paths", which would be triggered with a value like that mentioned above.

  13. steveg says:

    It’d be nifty if RegEdit linked directly to online documentation and/or there was a visual indication, perhaps line colour or icon, which values are documented/internal/public.

    How exactly non-MS companies would/could contribute to this fictional help database is left as an exercise for the reader.

  14. John says:

    Well, crap.  I have a fully up-to-date Windows 2000 virtual machine and the RunAsCommand value is never even queried.  I guess it was updated in SP4 or RU1 or something.  I am too lazy to reinstall a pre-SP4 build or something even earlier, so I give up.

  15. Gabe says:

    steveg: the Class of each value could be a pointer to the help DB entry.

  16. Duke of New York says:

    Third parties can and have written substitutes for regedit that address some of its annoyances.

    I would guess that even if someone at Microsoft wants to improve regedit, that won’t happen because:

    1. It needs to be simple and reliable enough to use as a troubleshooting tool when stuff hits the fan.

    2. It’s fundamentally not an end-user facing program.

  17. someone else says:

    @steveg: Considering as you are not supposed to tinker with regedit during normal operation of Windows, I don’t quite see the point there. If you think of changing a value there, you better know what you’re doing in the first place.

  18. ozzmosis says:

    Just a stab in the dark, but perhaps the original question was from someone who was attempting to reverse engineer some malware that was messing with the aforementioned registry key.

    Even if I’m wrong about that, I’m not sure it’s entirely fair to assume someone asking about undocumented things is trying to do harm.  It may just be idle curiosity.  For all we know, it may have simply been ommitted from the documentation by accident.

  19. DWalker says:

    In answer to the question, I don’t want to get off on a Vista tangent, but I had a hard time finding things in it at first.  I’m still using XP.  Vista is much better than the Vista bashers say, and I have been using it more of late, and it’s not bad at all.  I don’t understand the random slanted bands of dark and light in the active title bar, even when transparency is off…  

    I just decreased the boot time on my Mom’s ultra-small Vista laptop (1.2 GHz processor, with a reputation for slowness) from 4.3 minutes to 96 seconds by adding memory and removing third-party software.

    Windows 2000 was a vast improvement over Windows 98, which was better than Windows 95, which was WAY better than 3.1 or 3.11.  NT, on the other hand, was not so easy to configure…

    I WOULD say that XP is "so much better" than 2000.  I think I did!  

  20. C E Pizano says:

    Raymond, thanks for taking the time to look into my question.

    "Kind of makes me wonder why you’re asking about the registry value anyway, seeing as it’s undocumented in the first place. "

    Well, the thing is that undocumented might be a temporary situation. The ‘App Paths’ is somewhat documented so I suspected this was a hole in the documentation.

    "Are you trying to reverse-engineer Windows?"

    That is a rather zen question. In the strict interpretation then NO. There are tools and better forums for RE questions.

    In the loose sense YES, we -your readership- are all trying to reverse engineer the thoughts of the people that make windows. You are our guide into this effort.

    We just want to be better programmers and instead to try to remember one million factoids you are helping us to create a mental picture of the inner workings of windows.

Comments are closed.

Skip to main content