'so hard to convert....registry C# and powershell

  • I have a PowerShell script that editing on windows registry...

  • now I am learning C# and tried to open script with C# but registry didn't change. I don't know why

  • so I want to convert PowerShell to C# I wanna create a converter !

  • some thing like notepad replace but better

this code

$StartIsBackConfig = "HKCU:\SOFTWARE\StartIsBack"
Set-ItemProperty -Path $StartIsBackConfig -Name "AutoUpdates" -Value 0 -Force
Set-ItemProperty -Path $StartIsBackConfig -Name "ModernIconsColorized" -Value 1 -Force
Set-ItemProperty -Path $StartIsBackConfig -Name "AllProgramsFlyout" -Value 0 -Force
Set-ItemProperty -Path $StartIsBackConfig -Name "CombineWinX" -Value 1 -Force

to this code

RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\StartIsBack", true);
key.SetValue("AutoUpdates", "0", RegistryValueKind.DWord);
key.SetValue("ModernIconsColorized", "1", RegistryValueKind.DWord);
key.SetValue("AllProgramsFlyout", "0", RegistryValueKind.DWord);
key.SetValue("CombineWinX", "1", RegistryValueKind.DWord);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source