try { ExecuteCommand(installKeyCommand); ExecuteCommand(activateCommand); Console.WriteLine("Activation Successful."); } catch (Exception ex) { Console.WriteLine("An error occurred: " + ex.Message); } }
static void ExecuteCommand(string command) { Process process = new Process(); process.StartInfo.FileName = "cmd.exe"; process.StartInfo.Arguments = $"/C {command}"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.Start(); activate windows 11 cmd
using System; using System.Diagnostics;