import json import os import subprocess current_folder_path = os.getcwd() app_name = f"{current_folder_path}\游戏文件\测试主菜单.exe" try: # 改变当前工作目录 os.chdir(f"{current_folder_path}\游戏文件") # 替换为launcher.exe的路径 launcher_path = app_name # 启动launcher.exe subprocess.run(f'"{launcher_path}"', encoding='utf-8', universal_newlines=True, shell=True) # app_process = subprocess.Popen([launcher_path]) except FileNotFoundError: print("找不到" + app_name + ".exe,请确保它与Python脚本在同一目录下。") except Exception as e: print("运行" + app_name + "时出现错误:", e) finally: app_process = None