首页
社区
课程
招聘
[原创]Windows维护工具Plus版
发表于: 2026-3-30 06:29 1616

[原创]Windows维护工具Plus版

2026-3-30 06:29
1616
收藏
免费 39
支持
分享
最新回复 (55)
雪    币: 55
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
51
2天前
0
雪    币: 0
活跃值: (25)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
52
666
1天前
0
雪    币: 132
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
53
支持,谢谢分享!
19小时前
0
雪    币: 132
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
54

改为python语言,让界面可视化:

import os

import subprocess

import tkinter as tk

from tkinter import ttk, messagebox, scrolledtext, simpledialog

import threading

import tempfile

import random

import re

from datetime import datetime, timedelta


class WindowsOptimizer:

    def __init__(self, root):

        self.root = root

        self.root.title("Windows运维工具 v2.0")

        self.root.geometry("900x700")

        self.root.resizable(True, True)

        

        # 设置图标(可选)

        try:

            self.root.iconbitmap(default="icon.ico")

        except:

            pass

        

        # 创建主框架

        self.main_frame = ttk.Frame(root, padding="10")

        self.main_frame.pack(fill=tk.BOTH, expand=True)

        

        # 标题

        title_label = ttk.Label(self.main_frame, text="Windows运维工具", font=("微软雅黑", 20, "bold"))

        title_label.pack(pady=10)

        

        info_label = ttk.Label(self.main_frame, text="作者: phenix | 邮箱: 279682817@qq.com", font=("微软雅黑", 10))

        info_label.pack()

        

        warning_label = ttk.Label(self.main_frame, text="请先关闭杀毒软件再运行,部分功能需要管理员权限", foreground="red")

        warning_label.pack(pady=5)

        

        # 创建进度条

        self.progress = ttk.Progressbar(self.main_frame, mode='indeterminate')

        self.progress.pack(fill=tk.X, pady=5)

        

        # 创建复选框框架(滚动区域)

        canvas_frame = ttk.Frame(self.main_frame)

        canvas_frame.pack(fill=tk.BOTH, expand=True, pady=10)

        

        canvas = tk.Canvas(canvas_frame)

        scrollbar = ttk.Scrollbar(canvas_frame, orient="vertical", command=canvas.yview)

        self.checkbox_frame = ttk.Frame(canvas)

        

        self.checkbox_frame.bind("<Configure>", lambda e: canvas.configure(scrollregion=canvas.bbox("all")))

        canvas.create_window((0, 0), window=self.checkbox_frame, anchor="nw")

        canvas.configure(yscrollcommand=scrollbar.set)

        

        canvas.pack(side="left", fill="both", expand=True)

        scrollbar.pack(side="right", fill="y")

        

        # 功能列表

        self.features = [

            ("磁盘清理 (cleanmgr)", self.disk_cleanup),

            ("检查文件系统错误 (chkdsk)", self.check_disk_errors),

            ("设置分页文件", self.set_paging_file),

            ("扫描系统文件完整性 (sfc)", self.scan_system_files),

            ("ReadyBoost 准备", self.readyboost_prepare),

            ("恶意软件扫描 (MRT)", self.malware_scan),

            ("获取WiFi密码", self.get_wifi_password),

            ("获取网络信息", self.get_network_info),

            ("获取硬盘信息", self.get_disk_info),

            ("获取系统信息", self.get_system_info),

            ("暂停Windows更新", self.pause_windows_update),

            ("检查系统盘空间", self.check_system_disk_space),

            ("整理桌面文件", self.organize_desktop),

            ("检查多余安全软件", self.check_security_software),

            ("存储设置指引", self.storage_settings_guide),

            ("磁盘整理 (defrag)", self.defrag_disks),

            ("关闭后台应用指引", self.disable_background_apps),

            ("关闭启动项指引", self.disable_startup),

            ("关闭传递优化指引", self.disable_delivery_optimization),

            ("关闭Edge后台服务", self.disable_edge_services),

            ("设置电源按钮功能", self.set_power_button),

            ("设置CPU核心数", self.set_cpu_cores),

            ("360优化设置指引", self.optimize_360),

            ("WPS优化设置指引", self.optimize_wps),

            ("关闭通知指引", self.disable_notifications),

            ("性能优先设置指引", self.set_performance_mode),

            ("清理活动历史记录", self.clear_activity_history),

            ("安装组策略并设置QoS", self.install_gpedit_and_qos),

        ]

        

        # 创建复选框变量

        self.check_vars = []

        row = 0

        for i, (name, _) in enumerate(self.features):

            var = tk.BooleanVar()

            cb = ttk.Checkbutton(self.checkbox_frame, text=name, variable=var, width=50)

            cb.grid(row=row, column=i % 2, sticky='w', padx=10, pady=5)

            self.check_vars.append(var)

            if i % 2 == 1:

                row += 1

        if len(self.features) % 2 == 1:

            row += 1

        

        # 按钮框架

        button_frame = ttk.Frame(self.main_frame)

        button_frame.pack(fill=tk.X, pady=10)

        

        select_all_btn = ttk.Button(button_frame, text="全选", command=self.select_all)

        select_all_btn.pack(side=tk.LEFT, padx=5)

        

        deselect_all_btn = ttk.Button(button_frame, text="取消全选", command=self.deselect_all)

        deselect_all_btn.pack(side=tk.LEFT, padx=5)

        

        run_btn = ttk.Button(button_frame, text="开始执行", command=self.run_selected, style="Accent.TButton")

        run_btn.pack(side=tk.LEFT, padx=20)

        

        clear_btn = ttk.Button(button_frame, text="清空日志", command=self.clear_log)

        clear_btn.pack(side=tk.LEFT, padx=5)

        

        # 日志输出区域

        log_frame = ttk.LabelFrame(self.main_frame, text="执行日志", padding="5")

        log_frame.pack(fill=tk.BOTH, expand=True)

        

        self.log_text = scrolledtext.ScrolledText(log_frame, height=15, font=("Consolas", 9))

        self.log_text.pack(fill=tk.BOTH, expand=True)

        

        # 状态栏

        self.status_bar = ttk.Label(self.main_frame, text="就绪", relief=tk.SUNKEN)

        self.status_bar.pack(fill=tk.X, pady=(5, 0))

        

        # 设置样式

        style = ttk.Style()

        style.configure("Accent.TButton", foreground="blue")

    

    def log(self, message, level="INFO"):

        """添加日志"""

        import time

        timestamp = time.strftime("%H:%M:%S")

        self.log_text.insert(tk.END, f"[{timestamp}] {message}\n")

        self.log_text.see(tk.END)

        self.root.update_idletasks()

    

    def clear_log(self):

        """清空日志"""

        self.log_text.delete(1.0, tk.END)

        self.log("日志已清空")

    

    def select_all(self):

        for var in self.check_vars:

            var.set(True)

        self.log("已全选所有功能")

    

    def deselect_all(self):

        for var in self.check_vars:

            var.set(False)

        self.log("已取消全选")

    

    def run_as_admin(self, command, args=None, wait=True):

        """以管理员权限运行命令"""

        try:

            if args:

                cmd = [command] + args

            else:

                cmd = command if isinstance(command, list) else [command]

            

            # 使用PowerShell提权

            ps_cmd = f'Start-Process -FilePath "{cmd[0]}"'

            if len(cmd) > 1:

                ps_cmd += f' -ArgumentList "{chr(32).join(cmd[1:])}"'

            ps_cmd += ' -Verb RunAs -WindowStyle Hidden'

            if wait:

                ps_cmd += ' -Wait'

            

            subprocess.run(["powershell", "-Command", ps_cmd], check=True, capture_output=True)

            return True

        except subprocess.CalledProcessError as e:

            self.log(f"执行失败: {e}", "ERROR")

            return False

    

    def run_command(self, command, capture=False):

        """运行命令"""

        try:

            if capture:

                result = subprocess.run(command, shell=True, capture_output=True, text=True, encoding='gbk')

                return result.stdout + result.stderr

            else:

                subprocess.run(command, shell=True, check=True)

                return True

        except subprocess.CalledProcessError as e:

            self.log(f"命令执行失败: {e}", "ERROR")

            return False if not capture else ""

    

    def run_selected(self):

        """运行选中的功能"""

        selected = [i for i, var in enumerate(self.check_vars) if var.get()]

        if not selected:

            messagebox.showwarning("提示", "请至少选择一个功能")

            return

        

        self.progress.start()

        self.status_bar.config(text="正在执行...")

        

        def run_in_thread():

            for idx in selected:

                name, func = self.features[idx]

                self.log(f"\n{'='*50}")

                self.log(f"开始执行: {name}")

                try:

                    func()

                    self.log(f"完成: {name}")

                except Exception as e:

                    self.log(f"错误: {name} - {str(e)}", "ERROR")

                self.log(f"{'='*50}\n")

            

            self.root.after(0, self.on_complete)

        

        thread = threading.Thread(target=run_in_thread, daemon=True)

        thread.start()

    

    def on_complete(self):

        """执行完成"""

        self.progress.stop()

        self.status_bar.config(text="执行完成")

        messagebox.showinfo("完成", "所有选中的功能已执行完毕")

    

    def ask_yes_no(self, message):

        """询问是否执行"""

        return messagebox.askyesno("确认", message)

    

    # ==================== 功能实现 ====================

    

    def disk_cleanup(self):

        """磁盘清理"""

        if self.ask_yes_no("是否需要磁盘清理?"):

            self.log("启动磁盘清理工具...")

            subprocess.run(["cleanmgr"], shell=True)

            self.log("磁盘清理工具已关闭")

    

    def check_disk_errors(self):

        """检查文件系统错误"""

        if self.ask_yes_no("是否需要检查文件系统错误?"):

            self.log("获取磁盘列表...")

            result = subprocess.run(["powershell", "-Command", "(fsutil fsinfo drives)"], 

                                   capture_output=True, text=True, encoding='gbk')

            drives = re.findall(r'[A-Z]:\\', result.stdout)

            

            for drive in drives:

                self.log(f"正在检查 {drive} 盘...")

                self.run_as_admin("chkdsk.exe", [drive, "/scan", "/forceofflinefix"])

            self.log("磁盘检查完成")

    

    def set_paging_file(self):

        """设置分页文件"""

        if self.ask_yes_no("是否需要设置分页文件(设置完毕需重启生效)?"):

            self.log("清除分页文件设置...")

            reg_cmd = 'reg add "HKLM\\System\\CurrentControlSet\\Control\\Session Manager\\Memory Management" /v PagingFiles /t REG_MULTI_SZ /d "?:\\pagefile.sys" /f'

            self.run_as_admin("reg.exe", [reg_cmd])

            self.log("分页文件设置完成,重启后生效")

    

    def scan_system_files(self):

        """扫描系统文件完整性"""

        if self.ask_yes_no("是否需要扫描系统文件完整性?"):

            self.log("开始扫描系统文件...")

            self.run_as_admin("sfc.exe", ["/scannow"])

            self.log("系统文件扫描完成")

    

    def readyboost_prepare(self):

        """ReadyBoost准备"""

        if self.ask_yes_no("是否需要准备ReadyBoost?"):

            if self.ask_yes_no("是否准备好了一个空白的U盘?"):

                if self.ask_yes_no("是否确定是空白的U盘?"):

                    self.log("启动SysMain服务...")

                    self.run_as_admin("net.exe", ["start", "sysmain"])

                    self.log("请在U盘属性中启用ReadyBoost功能")

                    messagebox.showinfo("提示", "请在打开的U盘属性中,选择ReadyBoost标签,然后选择'将该设备专用于ReadyBoost'")

                    subprocess.run(["explorer", "shell:MyComputerFolder"])

    

    def malware_scan(self):

        """恶意软件扫描"""

        if self.ask_yes_no("是否需要运行恶意软件扫描工具?"):

            self.log("启动恶意软件扫描工具...")

            self.run_as_admin("mrt.exe", [])

            self.log("恶意软件扫描工具已关闭")

    

    def get_wifi_password(self):

        """获取WiFi密码"""

        if self.ask_yes_no("是否需要获取WiFi密码?"):

            wifi_name = simpledialog.askstring("WiFi名称", "请输入WiFi名称:")

            if wifi_name:

                self.log(f"正在获取WiFi '{wifi_name}' 的密码...")

                temp_file = os.path.join(tempfile.gettempdir(), "wifi.txt")

                cmd = f'chcp 437 & netsh wlan show profiles name="{wifi_name}" key=clear > "{temp_file}"'

                self.run_as_admin("cmd.exe", ["/c", cmd])

                

                # 等待文件写入

                import time

                time.sleep(2)

                

                try:

                    with open(temp_file, 'r', encoding='utf-8', errors='ignore') as f:

                        content = f.read()

                    match = re.search(r'Key Content\s*:\s*(.+)', content)

                    if match:

                        password = match.group(1).strip()

                        desktop_file = os.path.join(os.path.expanduser("~"), "Desktop", "无线密码.txt")

                        with open(desktop_file, 'w', encoding='utf-8') as f:

                            f.write(f"WiFi: {wifi_name}\n密码: {password}")

                        self.log(f"WiFi密码已保存到桌面: {password}")

                        os.startfile(desktop_file)

                    else:

                        self.log("未找到WiFi密码")

                except Exception as e:

                    self.log(f"读取WiFi信息失败: {e}")

    

    def get_network_info(self):

        """获取网络信息"""

        if self.ask_yes_no("是否需要获取网络信息?"):

            self.log("正在获取网络信息...")

            desktop_file = os.path.join(os.path.expanduser("~"), "Desktop", "网络信息.txt")

            ps_cmd = f'Get-NetAdapter | Format-List -Property Name,InterfaceDescription,MacAddress,MediaType,PhysicalMediaType,LinkSpeed,MediaConnectionState,DriverInformation | Out-File -FilePath "{desktop_file}"'

            subprocess.run(["powershell", "-Command", ps_cmd], shell=True)

            self.log(f"网络信息已保存到桌面")

            os.startfile(desktop_file)

    

    def get_disk_info(self):

        """获取硬盘信息"""

        if self.ask_yes_no("是否需要获取硬盘信息?"):

            self.log("正在获取硬盘信息...")

            desktop_file = os.path.join(os.path.expanduser("~"), "Desktop", "硬盘信息.txt")

            ps_cmd = f'Get-PhysicalDisk | Format-List -Property Model,HealthStatus,SerialNumber,MediaType,Size | Out-File -FilePath "{desktop_file}"'

            subprocess.run(["powershell", "-Command", ps_cmd], shell=True)

            self.log(f"硬盘信息已保存到桌面")

            os.startfile(desktop_file)

    

    def get_system_info(self):

        """获取系统信息"""

        if self.ask_yes_no("是否需要获取系统信息?"):

            self.log("正在获取系统信息...")

            desktop_file = os.path.join(os.path.expanduser("~"), "Desktop", "系统信息.txt")

            ps_cmd = f'Get-ComputerInfo -Property CsManufacturer,CsModel,BiosManufacturer,OsName,OsArchitecture,OsWindowsDirectory,OsLanguage,TimeZone,CsProcessors,CsNumberOfLogicalProcessors,CsTotalPhysicalMemory | Format-List | Out-File -FilePath "{desktop_file}"'

            subprocess.run(["powershell", "-Command", ps_cmd], shell=True)

            self.log(f"系统信息已保存到桌面")

            os.startfile(desktop_file)

            subprocess.run(["dxdiag"], shell=True)

    

    def pause_windows_update(self):

        """暂停Windows更新"""

        if self.ask_yes_no("是否需要暂停Windows更新?"):

            days = simpledialog.askinteger("暂停更新", "请输入暂停天数:", minvalue=1, maxvalue=365)

            if days:

                self.log(f"暂停Windows更新 {days} 天...")

                now = datetime.now()

                end_time = now + timedelta(days=days)

                

                start_str = now.strftime("%Y-%m-%dT%H:%M:%SZ")

                end_str = end_time.strftime("%Y-%m-%dT%H:%M:%SZ")

                

                reg_path = "HKLM\\SOFTWARE\\Microsoft\\WindowsUpdate\\UX\\Settings"

                

                self.run_as_admin("reg.exe", [f'add "{reg_path}" /v PauseFeatureUpdatesStartTime /t REG_SZ /d "{start_str}" /f'])

                self.run_as_admin("reg.exe", [f'add "{reg_path}" /v PauseQualityUpdatesStartTime /t REG_SZ /d "{start_str}" /f'])

                self.run_as_admin("reg.exe", [f'add "{reg_path}" /v PauseUpdatesExpiryTime /t REG_SZ /d "{end_str}" /f'])

                self.run_as_admin("reg.exe", [f'add "{reg_path}" /v PauseFeatureUpdatesEndTime /t REG_SZ /d "{end_str}" /f'])

                self.run_as_admin("reg.exe", [f'add "{reg_path}" /v PauseQualityUpdatesEndTime /t REG_SZ /d "{end_str}" /f'])

                

                self.log(f"Windows更新已暂停 {days} 天")

    

    def check_system_disk_space(self):

        """检查系统盘空间"""

        if self.ask_yes_no("是否需要检查系统盘空间?"):

            self.log("请手动清理以下文件夹:")

            self.log("  - C:\\Windows\\Prefetch")

            self.log("  - C:\\Windows\\Temp")

            self.log("  - C:\\Windows\\System32\\LogFiles")

            self.log("  - 运行 %temp% 打开的临时文件夹")

            subprocess.run(["explorer", "C:\\Windows\\Prefetch"])

            subprocess.run(["explorer", "C:\\Windows\\Temp"])

            subprocess.run(["explorer", "C:\\Windows\\System32\\LogFiles"])

            subprocess.run(["explorer", os.environ.get("TEMP", "%temp%")])

    

    def organize_desktop(self):

        """整理桌面文件"""

        if self.ask_yes_no("是否需要整理桌面文件?"):

            desktop = os.path.join(os.path.expanduser("~"), "Desktop")

            target_dir = "C:\\整理桌面"

            

            if not os.path.exists(target_dir):

                os.makedirs(target_dir)

            

            for item in os.listdir(desktop):

                item_path = os.path.join(desktop, item)

                if os.path.isfile(item_path) and not item.endswith(('.bat', '.lnk')):

                    new_name = f"{random.randint(1, 999999)}{item}"

                    new_path = os.path.join(desktop, new_name)

                    os.rename(item_path, new_path)

                    shutil.move(new_path, target_dir)

                elif os.path.isdir(item_path) and item != "整理桌面":

                    try:

                        shutil.move(item_path, target_dir)

                    except:

                        pass

            

            # 创建目录链接

            try:

                subprocess.run(f'mklink /j "{desktop}\\整理桌面" "{target_dir}"', shell=True)

            except:

                pass

            

            self.log(f"桌面文件已移动到 {target_dir}")

    

    def check_security_software(self):

        """检查安全软件"""

        self.log("检查已安装的安全软件...")

        result = subprocess.run(["powershell", "-Command", "Get-Package | Select-Object Name"], 

                               capture_output=True, text=True, encoding='gbk')

        

        security_keywords = ["360", "金山", "毒霸", "瑞星", "腾讯电脑管家", "kaspersky", "avg", "mcafee", "avast"]

        found = [kw for kw in security_keywords if kw.lower() in result.stdout.lower()]

        

        if found:

            self.log(f"发现安全软件: {', '.join(found)}")

            if self.ask_yes_no("发现多个安全软件,是否打开程序和功能进行管理?"):

                subprocess.run(["appwiz.cpl"], shell=True)

        else:

            self.log("未发现多余的安全软件")

    

    def storage_settings_guide(self):

        """存储设置指引"""

        if self.ask_yes_no("是否需要存储设置指引?"):

            guide = """

存储优化设置指引:

1. 右键开始菜单 → 系统 → 存储 → 打开存储感知开关

2. 配置存储感知 → 设置为每天运行

3. 返回存储界面 → 选择"更改新内容的保存位置"

4. 将所有类型改为其他盘(如D盘)

5. 返回存储界面 → 选择"临时文件" → 删除文件

            """

            self.log(guide)

            messagebox.showinfo("存储设置指引", guide)

    

    def defrag_disks(self):

        """磁盘整理"""

        if self.ask_yes_no("是否需要磁盘整理?"):

            self.log("获取磁盘列表...")

            result = subprocess.run(["powershell", "-Command", "(fsutil fsinfo drives)"], 

                                   capture_output=True, text=True, encoding='gbk')

            drives = re.findall(r'[A-Z]:', result.stdout)

            

            for drive in drives:

                self.log(f"正在整理 {drive} 盘...")

                self.run_as_admin("defrag.exe", [drive, "/U", "/V"])

            self.log("磁盘整理完成")

    

    def disable_background_apps(self):

        """关闭后台应用指引"""

        if self.ask_yes_no("是否需要关闭后台应用指引?"):

            guide = """

关闭后台应用指引:

1. 右键开始菜单 → 设置 → 隐私

2. 选择"后台应用"

3. 关闭"允许应用在后台运行"开关

4. 选择左侧"常规" → 关闭所有隐私选项

            """

            self.log(guide)

            messagebox.showinfo("关闭后台应用指引", guide)

    

    def disable_startup(self):

        """关闭启动项"""

        if self.ask_yes_no("是否需要关闭启动项?"):

            self.log("禁用快速启动...")

            self.run_as_admin("reg.exe", ['add "HKLM\\System\\CurrentControlSet\\Control\\Session Manager\\Power" /v HiberbootEnabled /t REG_DWORD /d "0" /f'])

            

            guide = """

关闭启动项指引:

1. Ctrl+Shift+Esc 打开任务管理器

2. 切换到"启动"选项卡

3. 右键不需要的启动项 → 禁用

            """

            self.log(guide)

            messagebox.showinfo("关闭启动项指引", guide)

    

    def disable_delivery_optimization(self):

        """关闭传递优化"""

        if self.ask_yes_no("是否需要关闭传递优化指引?"):

            guide = """

关闭传递优化指引:

1. 右键开始菜单 → 设置 → 更新和安全

2. 选择"传递优化"

3. 关闭"允许从其他电脑下载"开关

            """

            self.log(guide)

            messagebox.showinfo("关闭传递优化指引", guide)

    

    def disable_edge_services(self):

        """关闭Edge后台服务"""

        if self.ask_yes_no("是否需要关闭Edge后台服务?"):

            self.log("停止Edge服务...")

            services = ["MicrosoftEdgeElevationService", "edgeupdate", "edgeupdatem"]

            for service in services:

                self.run_as_admin("net.exe", ["stop", service])

                self.run_as_admin("reg.exe", [f'add "HKLM\\System\\CurrentControlSet\\Services\\{service}" /v Start /t REG_DWORD /d "4" /f'])

            

            guide = """

Edge浏览器设置:

1. 打开Edge浏览器 → 设置

2. 选择"系统和性能"

3. 关闭"在Microsoft Edge关闭后继续运行后台扩展和应用"

            """

            self.log(guide)

            messagebox.showinfo("Edge优化", guide)

    

    def set_power_button(self):

        """设置电源按钮功能"""

        if self.ask_yes_no("是否需要设置电源按钮功能指引?"):

            guide = """

设置电源按钮功能指引:

1. 右键开始菜单 → 电源选项

2. 选择"其他电源设置"

3. 选择"选择电源按钮的功能"

4. 设置"按电源按钮时"为"关机"

5. 点击保存修改

            """

            self.log(guide)

            messagebox.showinfo("电源按钮设置", guide)

    

    def set_cpu_cores(self):

        """设置CPU核心数"""

        if self.ask_yes_no("是否需要设置CPU核心数(需重启)?"):

            guide = """

设置CPU核心数指引:

1. Ctrl+Shift+Esc 打开任务管理器

2. 文件 → 运行新任务

3. 输入"msconfig",勾选"以系统管理权限创建此任务"

4. 选择"引导" → "高级选项"

5. 勾选"处理器个数",选择最大数量

6. 确定并重启

            """

            self.log(guide)

            messagebox.showinfo("CPU设置", guide)

    

    def optimize_360(self):

        """360优化设置"""

        if self.ask_yes_no("是否需要360优化设置指引?"):

            guide = """

360安全卫士优化指引:

1. 打开360 → 设置

2. 功能定制 → 关闭"显示首页安全播报"

3. 关闭"显示主界面搜索框"

4. 开机小助手 → 全部取消勾选

5. 广告资讯设置 → 关闭所有开关

            """

            self.log(guide)

            messagebox.showinfo("360优化", guide)

    

    def optimize_wps(self):

        """WPS优化设置"""

        if self.ask_yes_no("是否需要WPS优化设置指引?"):

            guide = """

WPS Office优化指引:

1. 右键WPS图标 → 打开文件所在位置

2. 进入第一个文件夹 → office6

3. 找到ksomisc.exe并运行

4. 选择"高级" → "功能定制"

5. 关闭:模板推荐、在线素材资源推荐、场景化功能推荐

            """

            self.log(guide)

            messagebox.showinfo("WPS优化", guide)

    

    def disable_notifications(self):

        """关闭通知"""

        if self.ask_yes_no("是否需要关闭通知?"):

            guide = """

关闭通知指引:

1. 右键开始菜单 → 设置 → 系统

2. 选择"通知和操作"

3. 关闭"获取来自应用和其他发送者的通知"

            """

            self.log(guide)

            messagebox.showinfo("通知设置", guide)

    

    def set_performance_mode(self):

        """性能优先设置"""

        if self.ask_yes_no("是否需要设置性能优先?"):

            guide = """

性能优先设置指引:

1. 右键开始菜单 → 系统 → 高级系统设置

2. 高级 → 性能设置 → 视觉效果

3. 选择"调整为最佳性能"

4. 电源选项 → 创建电源计划

5. 选择"高性能" → 保存

            """

            self.log(guide)

            messagebox.showinfo("性能优化", guide)

            subprocess.run(["SystemPropertiesPerformance.exe"], shell=True)

            subprocess.run(["powercfg.cpl"], shell=True)

    

    def clear_activity_history(self):

        """清理活动历史记录"""

        if self.ask_yes_no("是否需要清理活动历史记录?"):

            guide = """

清理活动历史记录指引:

1. 右键开始菜单 → 设置 → 隐私

2. 选择"活动历史记录"

3. 关闭所有开关

4. 点击"清除活动历史记录"

            """

            self.log(guide)

            messagebox.showinfo("隐私清理", guide)

    

    def install_gpedit_and_qos(self):

        """安装组策略并设置QoS"""

        if self.ask_yes_no("是否需要安装组策略并设置QoS?"):

            self.log("检查并安装组策略...")

            packages_path = "C:\\Windows\\Servicing\\Packages"

            if os.path.exists(packages_path):

                import glob

                pattern1 = "Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum"

                pattern2 = "Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum"

                

                for pattern in [pattern1, pattern2]:

                    for package in glob.glob(os.path.join(packages_path, pattern)):

                        self.run_as_admin("dism.exe", ["/online", "/norestart", f"/add-package:{package}"])

            

            guide = """

设置QoS带宽限制:

1. Win+R 输入 gpedit.msc

2. 计算机配置 → 管理模板 → 网络

3. QoS数据包计划程序 → 限制可保留带宽

4. 选择"已启用",将带宽限制从80改为0

5. 确定

            """

            self.log(guide)

            messagebox.showinfo("组策略设置", guide)


# 添加shutil模块导入

import shutil


if __name__ == "__main__":

    root = tk.Tk()

    app = WindowsOptimizer(root)

    root.mainloop()


最后于 19小时前 被mb_yifrdruh编辑 ,原因:
上传的附件:
19小时前
1
雪    币: 200
活跃值: (20)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
55
感谢分享
9小时前
0
雪    币: 226
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
56
谢谢分享
1小时前
0
游客
登录 | 注册 方可回帖
返回