How can I generate a UUID in Winbatch?
guid1 = ObjectClrNew( 'System.Guid' )
; The class [System.Guid] has a static method, NewGuid(), that generates a random GUID/UUID value.
; However, I'm not sure how to get WinBatch to execute the static method on the class itself,
; so we take the class instance in "guid1" and use it to invoke the static method.
newguid = guid1.NewGuid()
Pause( 'GUID', 'newguid = ':newguid.ToString('b') )
As you have discovered, WIL scopes static members by using "classobject.staticmember" syntax.
Noted for future reference.
Quote from: td on June 05, 2020, 08:51:45 AM
As you have discovered, WIL scopes static members by using "classobject.staticmember" syntax.
Not really related but I'm just beginning to learn the use of :: in PS - aha moment, it's a static member as opposed to . which generates an instance
[guid]::NewGuid()