Generate GUID using vbscript

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

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

Generate GUID using vbscript_第1张图片

 

如何用 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, 2, 36)  & VbCrLf &  "GUID 2: " & Left(TypeLib.Guid, 38)  & VbCrLf &  "GUID 3: " & TypeLib.Guid

End Function

 

执行结果:

Generate GUID using vbscript_第2张图片

 

参考:

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

 

你可能感兴趣的:(VBScript)