How many times program has run? C#

前端 未结 9 828
情歌与酒
情歌与酒 2020-12-17 02:26

How can I get the number of times a program has previously run in C# without keeping a file and tallying. If it is not possible that way, can it be gotten from the Scheduled

9条回答
  •  没有蜡笔的小新
    2020-12-17 02:27

    The number of time an app has run is stored in the registry; there are a couple of caveats, though:

    1. It's stored in the user registry (HKCU for instance) [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist]
    2. The path is stored in ROT13 so for instance runme.exe would become ehazr.rkr
    3. The registry actually stores three values in binary form: the last runtime, the run count (which starts at 6 instead of 1, for some reason), and the name of the application.

    Don't know if this helps, but there you have it!

提交回复
热议问题