如何将安装日期记录到注册表

发布于 2024-08-29 12:34:39 字数 75 浏览 3 评论 0原文

安装成功完成后,需要将日期和时间以及其他一些信息写入注册表。如何生成日期以及如何知道安装是否成功完成? (用wix写入注册表不是问题)。

When an install completes successfully, the date and time and some other info needs to be written to the registry. How can a date be generated and how do you know if an install was completed successfully? (writing to the registry with wix is not a problem).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

橙幽之幻 2024-09-05 12:34:39

使用标准 MSI 属性 日期时间

注意:请注意,尽管文档中指示日期的格式始终为 MM/DD/YYYY 格式,但这实际上并不是案件。我的系统(在澳大利亚)上的详细 MSI 日志以 DD/MM/YYYY 格式显示该属性...例如:

Property(S): Date = 21/04/2010

What about using standard MSI properties Date and Time?

Note: Be warned that despite the documentation indicating the date will always be in the MM/DD/YYYY format, this is not in fact the case. A verbose MSI log on my system (in Australia) shows the property in DD/MM/YYYY format... e.g.:

Property(S): Date = 21/04/2010
回眸一遍 2024-09-05 12:34:39

对于日期和时间,这里有一些示例代码。

<RegistryValue Id="InstallDateTime"
               KeyPath="yes"
               Name="InstallDateTime"
               Value='[Date] [Time]'
               Type="string" />

在此处输入图像描述

如果您想使用分隔符,只需将其添加为文本,例如:

<RegistryValue Id="InstallDateTime"
               KeyPath="yes"
               Name="InstallDateTime"
               Value='[Date]-[Time]'
               Type="string" />

在此处输入图像描述

For both date and time here is some sample code.

<RegistryValue Id="InstallDateTime"
               KeyPath="yes"
               Name="InstallDateTime"
               Value='[Date] [Time]'
               Type="string" />

enter image description here

If you want to use separator you can simply add it as text like:

<RegistryValue Id="InstallDateTime"
               KeyPath="yes"
               Name="InstallDateTime"
               Value='[Date]-[Time]'
               Type="string" />

enter image description here

就像说晚安 2024-09-05 12:34:39

环境变量??


您可以访问 PATH 等环境变量吗??

  • 这些返回当前系统日期和时间...

    您可能想要访问%DATE% & %TIME%

或者,由于您能够访问注册表,因此您可以访问注册表本身中的环境变量:

HKEY_CURRENT_USER\Environment\<variable>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\<variable>

祝您好运!!

Env variables??


Can you access environment variables like PATH etc. ??

  • These return the current system date and time...

    You might want to access %DATE% & %TIME%

Alternately, since You are able to access the Registry, You can access the Env vars in the registry itself:

HKEY_CURRENT_USER\Environment\<variable>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\<variable>

GoodLUCK!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文