• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

GUID - Generate in Windows


Brink

Administrator
Administrator
mvp
Posts
23,740
GUID - Generate in Windows
This tutorial will show you how to quickly generate a new GUID (UUID) in XP, Vista, Windows 7, and Windows 8.
Published by Brink
#1
Category:
ByLine
How to Generate a New GUID or UUID in Windows
Synopsis
This tutorial will show you how to quickly generate a new GUID (UUID) in XP, Vista, Windows 7, and Windows 8.
How to Generate a New GUID or UUID in Windows

information   Information
GUID (or UUID) is an acronym for 'Globally Unique Identifier' (or 'Universally Unique Identifier'). The term GUID is generally used by developers working with Microsoft technologies, while UUID is used everywhere else.

A GUID is represented as a 32-character hexadecimal string, such as {dcab32b8-e5ec-4f09-af89-44634bc7a04d}, and is usually stored in the form of a 128bit integer. It's nearly impossible for the numbers generated for the GUID to have two numbers repeated making them unique.

For more information about GUID, see:

This tutorial will show you how to quickly generate a new GUID (UUID) in XP, Vista, Windows 7, and Windows 8.

Note   Note
Windows 7 and Windows 8 comes with the PowerShell feature included.

In XP and Vista, you will need to download and install PowerShell.




OPTION ONE
To Generate a New GUID in PowerShell

1. Open PowerShell, copy and paste either command below, and press Enter.​
[guid]::NewGuid()
OR
[guid]::NewGuid().ToString()
2. The generated 32-character number will be the new GUID.​
PowerShell_GUID.png
PowerShell_GUID-2.png






OPTION TWO
To Generate a New GUID in Command Prompt


Note   Note
This option uses a PowerShell command in a command prompt, so you will still need to have PowerShell installed (XP and Vista).

If you like, you can also use the command below in a .bat or .cmd file.


1. Open a command prompt, copy and paste either command below, and press Enter.​
powershell -Command "[guid]::NewGuid()"
OR
powershell -Command "[guid]::NewGuid().ToString()"
2. The generated 32-character number will be the new GUID.​
Command_GUID-1.png
Command_GUID-2.png


That's it,
Shawn


 
Last edited:

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    1TB Samsung 970 EVO Plus M.2,
    250GB Samsung 960 EVO M.2,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

xpclient

Classic Shell tester
Member
Posts
62
#2
Cool trick. PowerShell is capable of doing so many things!
 

My Computer

System One

  • OS
    Microsoft Windows
    Other Info
    I do the testing and give feedback on User Experience and ideas for Classic Shell.

MilesAhead

Eclectician
VIP Member
Pro User
Posts
2,130
#3

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
Posts
1,870
#4
Why would you want to do this though? Just for VMs?
 

My Computer

System One

  • OS
    Windows 10 Pro Prieview x64
    Computer type
    Laptop
    System Manufacturer/Model
    MacBook Pro Core2Duo
    CPU
    T7600
    Memory
    3
    Graphics Card(s)
    ATI Radeon X1600
    Monitor(s) Displays
    Internal
    Screen Resolution
    1440 x 800
    Hard Drives
    40GB
    Keyboard
    Apple
    Mouse
    Apple
    Internet Speed
    Varies
    Browser
    Various
    Antivirus
    Defender

MilesAhead

Eclectician
VIP Member
Pro User
Posts
2,130
#5
Why would you want to do this though? Just for VMs?
Programmers use Guids much more than users. It avoids name collisions. For example I can create a named memory mapped file, or mutex, or semaphore. Programmers used to do stuff like make up names they thought would be unique. Example, MyVeryOwnUniqueSeamaphoreNamexxxxx. If someone else just happened to come up with the same name you could have 2 programs fighting over the resource. But if I use a Guid generator to make this name, MySemaphore88c1f6a9-e063-4e5c-8161-c824ac987896 then no other generated guid should produce the part after MySemaphore. I just stuck MySemaphore on there because kernel object names, iirc, are not supposed to start with a number but a character.
 

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad
Posts
1,870
#6
OK thanks - I was thinking of the HDD GUID which you have to change for VMs. This is more like a random number generator for the strings we see in DCOM etc then if I understand you correctly.

EDIT: I am a programmer actually but on IBM i not windows. There you make up names for objects and are confined to 10 characters and only one directory level (well sort of). Guess what - you do get duplicates. Think how many programmers when writing a payroll program and confined to 10 characters will call it "PAYROLL". Almost all of them do.
 

My Computer

System One

  • OS
    Windows 10 Pro Prieview x64
    Computer type
    Laptop
    System Manufacturer/Model
    MacBook Pro Core2Duo
    CPU
    T7600
    Memory
    3
    Graphics Card(s)
    ATI Radeon X1600
    Monitor(s) Displays
    Internal
    Screen Resolution
    1440 x 800
    Hard Drives
    40GB
    Keyboard
    Apple
    Mouse
    Apple
    Internet Speed
    Varies
    Browser
    Various
    Antivirus
    Defender

MilesAhead

Eclectician
VIP Member
Pro User
Posts
2,130
#7
Yeah, Guid was created for COM/DCOM stuff. Depending how they are used sometimes they are called CLSID or whatnot. ActiveX is a good example. In Windows there's an associative array object for scripting named Scripting.Dictionary. But in the registry the name is associated with a CLSID.

And yeah I can believe over 90% named it PAYROLL. :) That's like the old unix linkers that only had 6 character names. Linux is still burdened with the short program names for standard commands as a legacy.
 

My Computer

System One

  • OS
    Windows 8.0 x64
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satelite C55D-A Laptop
    CPU
    AMD EI 1200
    Memory
    4 gb DDR3
    Graphics Card(s)
    Raedon 340 MB dedicated Ram
    Monitor(s) Displays
    Built in
    Screen Resolution
    1366 x 768
    Hard Drives
    640 GB (spinner) Sata II
    Keyboard
    Built in
    Mouse
    Touch pad

Brink

Administrator
Administrator
mvp
Posts
23,740
#9
Hello Dragon Drop,

Yes, you could assign a GUID to open a folder when referenced. For example, you would reference the GUID when adding a folder or item to This PC or Control Panel.

What did you have in mind? :)
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    1TB Samsung 970 EVO Plus M.2,
    250GB Samsung 960 EVO M.2,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Dragon Drop

Member
Member
Posts
318
#10
I mean, if I've created a new GUID and I want it to represent a certain folder, how do I TELL Windows which folder I want it to represent? Do I have to create a new Registry key or something?
 

My Computer

System One

  • OS
    64-bit Windows 8
    System Manufacturer/Model
    HP 23-D030

Brink

Administrator
Administrator
mvp
Posts
23,740
#11
Yep, it would involve manually adding the GUID and other keys to the registry for this.

What were you wanting to do this for the folder with the GUID? It all depends for what you may need to do in the registry. There may also be an alternative for the folder.
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    1TB Samsung 970 EVO Plus M.2,
    250GB Samsung 960 EVO M.2,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Dragon Drop

Member
Member
Posts
318
#12
In all my experimenting with Windows, I've had occasion to use GUID's in several ways. But what I was thinking of at the moment was the special kind of shortcut links that you can create by using a GUID in the folder name. They create "expanding menus" when used in a toolbar. But you can only do that with a folder that has a GUID. An ordinary folder shortcut won't expand into a menu.
 

My Computer

System One

  • OS
    64-bit Windows 8
    System Manufacturer/Model
    HP 23-D030

Brink

Administrator
Administrator
mvp
Posts
23,740
#13
Well, here's an example of my E:\Images folder being referenced to a GUID in the registry to help. This would be the .reg file to add it for this.

Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{bcf54cb8-7ae3-4fa6-9ec5-573ef99f9912}]
@="[COLOR=#ff0000][B]Folder Name[/B][/COLOR]"

[HKEY_CLASSES_ROOT\CLSID\{bcf54cb8-7ae3-4fa6-9ec5-573ef99f9912}\Shell\Open\Command]
@="explorer [COLOR=#ff0000][B]E:\\Images[/B][/COLOR]"

Once added, here's an example of a shortcut target using the GUID to open the folder.


explorer.exe shell:::{bcf54cb8-7ae3-4fa6-9ec5-573ef99f9912}
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    1TB Samsung 970 EVO Plus M.2,
    250GB Samsung 960 EVO M.2,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Dragon Drop

Member
Member
Posts
318
#14
For some reason, the "Command" subkey wasn't getting any value. I fixed it by typing the value into the Registry myself, and now the GUID works when used as in your example.

Unfortunately, it still doesn't work the way I hoped it would -- i.e. when used in a folder's name to create a link. I've noted before that some GUID's work that way and some don't, though I still don't understand why. Anyway, thanks for your assistance. :)
 

My Computer

System One

  • OS
    64-bit Windows 8
    System Manufacturer/Model
    HP 23-D030

Brink

Administrator
Administrator
mvp
Posts
23,740
#15
Anytime. Is there any way to use the normal full path of the folder as the target of a shortcut for what you were wanting to do?
 

My Computer

System One

  • OS
    64-bit Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Custom self built
    CPU
    Intel i7-8700K OC'd to 5 GHz
    Motherboard
    ASUS ROG Maximus XI Formula Z390
    Memory
    16 GB (8GBx2) G.SKILL TridentZ DDR4 3200 MHz
    Graphics Card(s)
    ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
    Sound Card
    Integrated Digital Audio (S/PDIF)
    Monitor(s) Displays
    3 x 27" Asus VE278Q
    Screen Resolution
    1920x1080
    Hard Drives
    1TB Samsung 970 EVO Plus M.2,
    250GB Samsung 960 EVO M.2,
    6TB WD Black WD6001FZWX
    8TB WD MyCloudEX2Ultra NAS
    PSU
    OCZ Series Gold OCZZ1000M 1000W
    Case
    Thermaltake Core P3
    Cooling
    Corsair Hydro H115i
    Keyboard
    Logitech wireless K800
    Mouse
    Logitech MX Master
    Internet Speed
    1 Gb/s Download and 35 Mb/s Upload
    Browser
    Internet Explorer 11
    Antivirus
    Malwarebyte Anti-Malware Premium
    Other Info
    Logitech Z625 speaker system,
    Logitech BRIO 4K Pro webcam,
    HP Color LaserJet Pro MFP M477fdn,
    Linksys EA9500 router,
    Arris SB8200 cable modem,
    APC SMART-UPS RT 1000 XL - SURT1000XLI,
    Lumia 1520 phone

Dragon Drop

Member
Member
Posts
318
#16
In general, regular shortcuts are fine. But when you have a toolbar, like that one I designed with many items in it for that other tutorial, a shortcut won't open into a cascading sub-menu in the toolbar, unless it's the special kind of shortcut that I used there, made with a folder name like "AdminTools.{d20ea4e1-3957-11d2-a40b-0c5020524153}" and so on. I was hoping that kind of folder name would work with a GUID that I created, but it apparently doesn't.
 

My Computer

System One

  • OS
    64-bit Windows 8
    System Manufacturer/Model
    HP 23-D030

Users Who Are Viewing This Thread (Users: 0, Guests: 1)