(Python)exe启动工具,,心力交瘁,写了个小程


心力交瘁,写了个小程序

配合配置文件实现延迟启动exe

自动忽略带 “#” 开头的行

        ini 范本     这是路径          这是延迟(秒)C:\Users\1.exe         -n1   C:\Users\2.exe         -n5

  

.py

 1 import time 2 import win32api ,threading,os 3  4  5 def run1(l,s): 6     print("ok",l) 7     time.sleep(s) 8     win32api.ShellExecute(0,"open",l,"","",0) 9     10     11 12 13 txt = open("123.txt","r")14 dic = dict()15 print (os.path.abspath(‘.‘))16 for lin in txt:17     lin2 = []18     lin = lin.strip()19     20     if len(lin) > 0 and lin[0] != "#":21        22         if lin.count("\n") == len(lin):23     24             pass25             26         else:27             lin2 = lin.strip().split("-n")28             if len(lin2) == 2:29             30                 31                 t = threading.Thread(target=run1,args=(lin2[0],int(lin2[1])))32     33                 t.start()34 txt.close()35 t.join()36 exit()

小结 :

  并没有吃透

 网上搜索,东拼西凑,各种尝试,终于倒腾出来了。。

  想加个日志功能,但是好像有点复杂 

  好像并没有明显BUG (也没有认真测试 - -!)

(Python)exe启动工具

评论关闭