问题描述
我试图让我的用户从可执行文件文件夹中选择一个可执行文件。我的目的是将参数“/service”添加到该可执行文件中,然后让它运行。
目前用户正在将可执行文件复制到桌面,创建快捷方式,然后手动将 /service 添加到快捷方式作为解决方案。肯定有更好的方法!
有人可以看看这段代码并告诉我我可能遗漏了什么吗?
import ctypes
import os
import tkinter as tk
from tkinter import filedialog
#Hide the command window... use 6 instead of 0 for simply minimizing
ctypes.windll.user32.ShowWindow( ctypes.windll.kernel32.GetConsoleWindow(),0 )
#create the initial message window for the user
def MBox(title,text,style):
return ctypes.windll.user32.MessageBoxW(0,title,style)
MBox('Service Tools Installer','CLevertexthere',1)
root = tk.Tk()
root.withdraw()
#have the user select the file they want to use...
root.filename = filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("exe files","*.exe"),("all files","*.*")))
#Now to run the executable with the correct pass attached...
os.startfile (root.filename + "/service")
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)