Generate GUID using vbscript

在 .msi 中 的 Component table,查看 ComponentId 列,是一个16进制数的字符串,

Generate GUID using vbscript

用 InstallShield IDE 添加一个 component ,ComponentId 会自动生成,点击“Generate GUID” 会重新生成一个新的 ComponentId,

Generate GUID using vbscript

如何用 vbscript 生成 GUID 呢?

Call CreateGUID

Function CreateGUID
Dim TypeLib Set TypeLib = CreateObject("Scriptlet.TypeLib")
' (line 1) & VbCrLf & (line 2) is equivalent with \n , to start a new line
WScript.Echo "GUID 1: " & Mid(TypeLib.Guid, , ) & VbCrLf & "GUID 2: " & Left(TypeLib.Guid, ) & VbCrLf & "GUID 3: " & TypeLib.Guid End Function

执行结果:

Generate GUID using vbscript

参考:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/adc7c091-8476-4dc9-bd10-c28186982ae3/equivalent-for-a-n-new-line-character-in-visual-basic?forum=vbgeneral

上一篇:MyBatis定制SQL集中特殊的处理方式


下一篇:14.vue路由&脚手架