生成通用唯一标识符

Kev*_*tre 0 windows windows-7 windows-vista uuid windows-xp

是否可以在 Windows shell 脚本中生成通用唯一标识符或全局唯一标识符(UUID 或 GUID)?Linux / Unix / Mac OS X 有 bin 实用程序uuidgen,我很好奇 Windows 是否有等效程序。谢谢!

Jef*_*ood 6

如果您使用PowerShell,则非常简单:

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
Run Code Online (Sandbox Code Playgroud)