I remember in .NET 1.0 sdk there used be a sample which demonstrated how to modify registry through CSharp. By doing so it used to add an item into the context menu of folders in windows explorer. The best thing about that item was that it can be used to open a command window directly into that folder which is very useful if you work with lot of console applications.
Well, i couldn't find it in .NET 3.0 sdk samples but managed to find how to write such a sample.
Here is the code which is very simple and demonstrate the power of CSharp.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace RegistryProgram
{
class Program
{
static void Main(string[] args)
{
try
{
Registry.ClassesRoot.CreateSubKey("Directory\\shell\\CmdWindow");
RegistryKey rk = Registry.ClassesRoot.CreateSubKey("Directory\\shell\\CmdWindow\\command");
rk.SetValue("","cmd \"%1\"");
}
catch(System.Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}
}
}
~tata & take care~
Other Posts
- Tutorial : Developing a state machine workflow
- Kid's corner at MSDN
- Debugging & Profiling .NET applications
- Tip #5 : How to use an Application Configuration File to target a .NET Framework version
- Increasing Productivity/Discipline using Project Templates
- Visual Studio Code Name "Orcas" March CTP Released
- Microsoft Office System 2007 : The Composition
- Tutorial : Enterprise Library - Using Logging Application Block
No comments:
Post a Comment