wix SetProperty Before='AppSearch'

喜欢而已 提交于 2019-12-13 04:40:41

问题


How i can change date and time format? I need replace ":" to "_" in time. Below my code:

<SetProperty Before='AppSearch' Sequence='both' Id='HOSTNAME' Value="[ComputerName]_[Time]_[Date]">NOT HOSTNAME</SetProperty>

回答1:


The MSI SDK documents this pretty well: Time Property:

The format of the value depends upon the user's locale, and is the format obtained using GetTimeFormat function with the TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER option.

So the user's locale will affect the format, and then you probably need to use a custom action to get the formatting the way you want it. I can't think of any other way to do it.

All time silliest VBScript: (it is very late)

MsgBox Day(Now) & "_" & Month(Now) & "_" & Year(Now) & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now)

And just a hint for how to insert custom actions can be found here: How to execute conditional custom action on install and modify only?


  • https://ss64.com/vb/syntax-getdatetime.html
  • https://ss64.com/vb/syntax-getdate.html
  • https://www.w3schools.com/asp/asp_ref_vbscript_functions.asp
  • How do I get the Date & Time (VBS)


来源:https://stackoverflow.com/questions/53773242/wix-setproperty-before-appsearch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!