Skip to content

Instantly share code, notes, and snippets.

@RicottiDev
Created May 14, 2017 03:29
Show Gist options
  • Save RicottiDev/c51f355b7753b62ad38660445b5c4912 to your computer and use it in GitHub Desktop.
Save RicottiDev/c51f355b7753b62ad38660445b5c4912 to your computer and use it in GitHub Desktop.
Modificar Registro de Windows desde C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace Registro
{
class Program
{
static void Main(string[] args)
{
string userRoot = "HKEY_CURRENT_USER";
string subkey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced";
string keyName = userRoot + "\\" + subkey;
Console.WriteLine("1- Mostrar archivos ocultos");
Console.WriteLine("2- Ocultar archivos ocultos");
ConsoleKeyInfo reg = Console.ReadKey();
if (reg.Key == ConsoleKey.D1)
{
Registry.SetValue(keyName, "Hidden", 1, RegistryValueKind.QWord);
}
else
{
Registry.SetValue(keyName, "Hidden", 2, RegistryValueKind.QWord);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment