赞
踩
- import win32con
- import win32api
- import os
- def addfile2autorun(path):
- "注册到启动项"
- runpath = "Software\Microsoft\Windows\CurrentVersion\Run"
- hKey = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER, runpath, 0, win32con.KEY_SET_VALUE)
- (filepath, filename) = os.path.split(path)
- win32api.RegSetValueEx(hKey, "WindowsInit", 0, win32con.REG_SZ, path)
- win32api.RegCloseKey(hKey)
- addfile2autorun('D:\\Python源码\\Django.py')
引自http://bycnsky.appspot.com/302011.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。