Created
October 25, 2012 14:06
-
-
Save youcandanch/3952746 to your computer and use it in GitHub Desktop.
Quick console app to get VS2010 product key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Microsoft.Win32; | |
namespace RegCheck | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
RegistryKey visualStudioRegKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\10.0\\Registration\\2000.0x0000"); | |
String VSRegString = visualStudioRegKey.GetValue("PIDKEY").ToString(); | |
var builder = new StringBuilder(); | |
int count = 0; | |
foreach (var c in VSRegString) | |
{ | |
builder.Append(c); | |
if ((++count % 5) == 0) | |
{ | |
builder.Append('-'); | |
} | |
} | |
VSRegString = builder.ToString(); | |
Console.Write("Your Visual Studio Product Key Is: " + VSRegString); | |
Console.Read(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment