Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question
add comment

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.

share|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
    
s/eponymous/homonymous/ ;) –  Clément Apr 30 '13 at 13:47
add comment

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
share|improve this answer
    
Cool, thanks Jeff! –  Kevin Sylvestre Dec 25 '10 at 14:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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