-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove edge.cs
33 lines (29 loc) · 1.06 KB
/
remove edge.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
try
{
// Command to uninstall Microsoft Edge
string command = "powershell.exe -Command \"Get-AppxPackage *Microsoft.MicrosoftEdge* | Remove-AppxPackage\"";
// Start the process
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = "/C " + command;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
Console.WriteLine("Microsoft Edge has been removed successfully.");
Console.WriteLine(output);
}
catch (Exception ex)
{
Console.WriteLine("An error occurred: " + ex.Message);
}
}
}