Is it possible to generate a Universal Unique Identifier or Global Unique Identifier (UUID or GUID) in a Windows shell script? Linux / Unix / Mac OS X have the bin utility uuidgen and I'm curious if Windows has an equivalent. Thanks!

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

There is an eponymous Windows port of uuidgen available with Visual Studio.

Documentation is here and here.

link|improve this answer
Thanks for the answer! I don't have a copy of Visual Studio. Do you know if a universal binary is available for this? Thanks! – Kevin Sylvestre Dec 24 '10 at 1:09
Visual Studio Express Edition is free and can be downloaded from Microsoft. You could then pull out the specific files you need. – nhinkle Dec 24 '10 at 1:15
Sorry for all the questions (I don't use Windows as my main OS). Will I be able to package the identifier such that users downloading my script won't require installation of Visual Studio? If not it isn't really an option. Thanks! – Kevin Sylvestre Dec 24 '10 at 1:25
feedback

If you're using PowerShell it's very easy:

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\Jeff> $guid = [guid]::NewGuid()
PS C:\Users\Jeff> $guid

Guid
----
fe2858b1-2b70-4b2b-994d-3ff22f85244e
link|improve this answer
Cool, thanks Jeff! – Kevin Sylvestre Dec 25 '10 at 14:24
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.