Message 4
Message 4
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Microsoft.Win32;
namespace PCPerformanceBooster
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
try
{
var files = Directory.GetFiles(tempPath);
var directories = Directory.GetDirectories(tempPath);
try
{
Process.Start(new ProcessStartInfo
{
FileName = "powercfg",
Arguments = "/s SCHEME_MIN",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
});
try
{
string startupKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\
Run";
using (var key = Registry.CurrentUser.OpenSubKey(startupKey, true))
{
if (key != null)
{
var startupItems = key.GetValueNames();
foreach (var item in startupItems)
{
// Optionally exclude essential applications
if (!item.Contains("YourEssentialApp"))
{
key.DeleteValue(item, false);
Console.WriteLine($"Removed startup item: {item}");
}
}
}
}
try
{
Process.Start(new ProcessStartInfo
{
FileName = "cleanmgr",
Arguments = "/sagerun:1",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
});
string[] unnecessaryServices = {
"DiagTrack", // Connected User Experiences and Telemetry
"SysMain", // Superfetch
"WSearch", // Windows Search
"Fax",
"RemoteRegistry"
};
Process.Start(new ProcessStartInfo
{
FileName = "sc",
Arguments = $"stop {serviceName}",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
});