C# Guidgen Console app generates, replaces, finds, and reformats GUIDs from the command line. Supports clipboard, | (pipes), and lots of formats.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Binaries
source
.gitignore
README.md

README.md

GuidgenConsole

Guidgen Console app generates, replaces, finds, and reformats GUIDs from the command line.

Guidgen console (aka Guid Generator) is a command line application that generates X number of guids in the format you want - pasting them to the clipboard - if you wish. But that's not all! It also allows pipe usage to find and replace GUIDs or just run in the background as a reformatter. Oh, the number of times I just needed to convert from one format to another... Try going from code to SQL to LDAP and you'll understand, but if you do understand, then this app is for you.

Features

  • Guidgen works on the command line. No clunky windows app needed.
  • Guidgen is a portable windows app (as long as you have the .NET framework - and who doesn't?)
  • Can replace that antiquated Visual Studio Create GUID tool.
  • Generate GUID(s) in any number of formats.
  • Find GUID(s)
  • Reformat GUID(s)
  • Replace GUID(s) with new guids.

Guidgen can generate

  • Zero Guids
    • 00000000-0000-0000-0000-000000000000
  • Sequential Guids
    • c2d0e2e8-2b60-11e1-b1ea-0024e8359915
    • c2d0e2e9-2b60-11e1-b1ea-0024e8359915
    • c2d0e2ea-2b60-11e1-b1ea-0024e8359915
  • Plain Vanilla Guids
    • cf120f27-074c-43c0-80cb-57c1e3493c54
    • f9018966-a96c-482c-b608-8695a95fdb0b
    • a1065215-f596-445a-9e28-1aaba3a3e2be

Usage

c:\> guidgen.exe /?

usage: GuidGen.exe [N|D|P|B|C|CP|GUID|OLECREATE|DEFINE_GUID|H|HC#|HVB|HLDAP|
ORACLE|ORACLE_HEXTORAW|IP|VERSION|INT32|INT64|BASE64|BASE64C|MD5-[FORMAT]]
[/G|/S|/Z] [/nocopy] [/n (number)] [/u]

Output Formats:
N: 32 digits 0102030405060708090a0b0c0d0e0f10 D: 32 digits separated by hyphens (DEFAULT) 01020304-0506-0708-090a-0b0c0d0e0f10 P: 32 digits separated by hyphens, enclosed in (curly) braces {01020304-0506-0708-090a-0b0c0d0e0f10} B: 32 digits separated by hyphens, enclosed in brackets [01020304-0506-0708-090a-0b0c0d0e0f10] C: c format 0x01020304,0x0506,0x0708,0x090a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 CP: c format, enclosed in (curly) braces {0x01020304,0x0506,0x0708,0x090a,{0x0b,0x0c,0x0d,0x0e,0x0f,0x10}} GUID: c format, enclosed in (curly) braces static const GUID <<name>> = 0x01020304,0x0506,0x0708,0x090a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10; DEFINE_GUID: c format, enclosed in (curly) braces DEFINE_GUID(<<name>>,0x01020304,0x0506,0x0708,0x090a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10) OLECREATE: c format, enclosed in (curly) braces IMPLEMENT_OLECREATE(<<class>>,<<external_name>>,0x01020304,0x0506,0x0708,0x090a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10) H: HEX byte array 0403020106050807090a0b0c0d0e0f10 HC#: CSharp Hex byte array 0x04,0x03,0x02,0x01,0x06,0x05,0x08,0x07,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10 HVB: VB Hex byte array &H04,&H03,&H02,&H01,&H06,&H05,&H08,&H07,&H09,&H0a,&H0b,&H0c,&H0d,&H0e,&H0f,&H10 HLDAP: Hex byte array in ldap query form \\04\\03\\02\\01\\06\\05\\08\\07\\09\\0a\\0b\\0c\\0d\\0e\\0f\\10 ORACLE: ORACLE Hex byte array 04030201-0605-0807-090a-0b0c0d0e0f10 ORACLE_HEXTORAW: ORACLE Hex byte array with declaration HEXTORAW('04030201-0605-0807-090a-0b0c0d0e0f10') IP: IP Address format (IPv4/IPv6) 403:201:605:807:90a:b0c:d0e:f10 Version: Version format (Major.Minor.Build.Revision) 16909060.117966086.202050057.269422093 Int32: Int32 format (Int32, Int32, Int32, Int32) 16909060, 117966086, 202050057, 269422093 Int64: Int64 format (Int64, Int64) 506660481424032516, 1157159078456920585 BASE64: BAMCAQYFCAcJCgsMDQ4PEA== BASE64C: combine bytes to single base64 string AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= MD5-[FORMAT]: MD5 input string to Guid in the selected format (must use /find)
Type of GUID to create
G: New Guid (default) Z: Zero Guid S: Sequential Guid
Additional Arguments
/u: returns format in uppercase (unless base64) /count (number): will generate the given number of guids /n (number): same as /count /Find [format]: Finds guids in format /l: shows line number for found guids /copy: forces copy to clipboard /nocopy: does not copy to clipboard /Replace: replaces guid with (/Z|/S|/G) or same guid to specified output format /Replace [format]: replaces specified format with same guid or new guid if (/Z|/S|/G) is specified to specified output format /ReplaceByLine: like replace, but does everything per input line. (see above) /ReplaceByLine [format]: like replace, but does everything per input line. (see above) /guid (GUID): uses specified (GUID) as input for find and replace. /clipboard: uses clipboard for find and replace
Notes:
if find or replace is used and data is not piped in (ex: more find.txt | guidgen /find) then enter guids and then type "quit" to find/replace and end.

Where can I get it?

Latest binaries in the binaries folder of the project or use powershell and chocolatey! v2.0.0.3+ - Chocolately install will download the binary from github and try to install the highest matching .NET version. If no matching versions, you get the latest version of 4.5.
PS C:\> choco install guidgen-console

What dependencies does it have?

The latest version is built against the .NET Framework version 4.7.
available at: http://go.microsoft.com/fwlink/?LinkId=671729
There are binaries available for .NET frameworks: 2.0,3.5,4.0,4.5,4.6,4.7

Where do I install it?

Install it where ever you want!
I personally use chocolatey which installs a shim in %ALLUSERSPROFILE%\chocolatey\bin that points to %ALLUSERSPROFILE%\chocolatey\lib\guidgen-console\guidgen.exe . The shim is already in the path, so you can run it from anywhere!

Can I change the defaults?

Yes! Add (or change) guidgen.exe.config
If you used chocolatey to install, the file should be in %ALLUSERSPROFILE%\chocolatey\lib\guidgen-console\
<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<appSettings>
		<add key="default:output:format" value="D" />
		<add key="default:guid:type" value="G" />
		<add key="default:example" value="01020304-0506-0708-090a-0b0c0d0e0f10" />
	</appSettings>
	
</configuration>

How do I add it to Visual Studio Tools?

Goto: Tools > External Tools
Set the title, location where you saved it and any command line arguments.
Click the "Use Output Window"
Move it to the top.
Click ok.
Also add a quick key Ctrl-~
Goto: Tools > Options > Environment > Keyboard
Select "Tools.ExternalCommand1" (if you moved it to the top...)
Press the key combination.
Click ok.

Example Usage

Generate a guid:
c:\> guidgen D
3dbacc0e-940a-4386-bce9-adc285f45ffe
Generate a upper-cased guid:
c:\> guidgen D /u
2EE89794-7759-4425-80DC-126F73264B30
Generate 3 sequential guids:
c:\> guidgen D /S /n 3
21638464-8ef4-11e1-acb0-0024e8359915
21638465-8ef4-11e1-acb0-0024e8359915
21638466-8ef4-11e1-acb0-0024e8359915
Replace guid with another format:
c:\> guidgen HC# /replace /guid 21638464-8ef4-11e1-acb0-0024e8359915
0x64,0x84,0x63,0x21,0xf4,0x8e,0xe1,0x11,0xac,0xb0,0x00,0x24,0xe8,0x35,0x99,0x15
c:\> guidgen D /replace H /guid "64 84 63 21 f4 8e e1 11 ac b0 00 24 e8 35 99 15"
21638464-8ef4-11e1-acb0-0024e8359915
Replace guid with another guid in same format: (replace format may be required.)
c:\> guidgen /G /replace D /guid 21638464-8ef4-11e1-acb0-0024e8359915
aad71ce1-31d9-409b-ba83-398c8a62cdec
Find Guids (with line numbers):
c:\> guidgen N /n 3 > guids.txt
c:\> more guids.txt | guidgen D /find /l
Ln: 0 Col: 0    aa4a2c8a-37ac-432d-afc2-40f62b1d01a2    aa4a2c8a37ac432dafc240f62b1d01a2
Ln: 1 Col: 0    70e5d73a-6b06-4b3e-a473-cdbbedf85f61    70e5d73a6b064b3ea473cdbbedf85f61
Ln: 2 Col: 0    4bae3611-fdc7-4af3-b47a-b36e5fc9d45a    4bae3611fdc74af3b47ab36e5fc9d45a
Reformat guids:
c:\> guidgen P /u /replacebyline
Type "quit" to quit
> c272825f-79ab-4fcc-b265-e07c488ed8ae
{C272825F-79AB-4FCC-B265-E07C488ED8AE}
> quit
Any string to guid:
c:\> guidgen MD5-D /find MD5-D /replace /guid "MD5 String 2 Guid?"
6c0a3a7d-05bc-429d-f6ca-502b1fbb23df
c:\> guidgen MD5-D /replacebyline MD5-D
Type "quit" to quit
> Why do this?
488bcdc4-7ed5-4f10-c644-4d655cf8663e
> I Don't Know
4bd31432-d910-a870-b617-e1a1666c67a9
> I Don't Know
4bd31432-d910-a870-b617-e1a1666c67a9
> Because we can!
b8ecc945-c302-dd2d-7921-9081211480b1
> quit