startup.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:persepolis 作者: persepolisdm 项目源码 文件源码
def removestartup():
    # check if it is linux
    if os_type == 'Linux' or os_type == 'FreeBSD' or os_type == 'OpenBSD':

        # remove it
        os.remove(home_address + "/.config/autostart/persepolis.desktop")

    # check if it is mac OS
    elif os_type == "Darwin":
        # OS X
        if checkstartup():
            os.system('launchctl unload ' + home_address +
                      "/Library/LaunchAgents/com.persepolisdm.plist")
            os.remove(home_address +
                      "/Library/LaunchAgents/com.persepolisdm.plist")

    # check if it is Windows
    elif os_type == 'Windows':
        if checkstartup():
            # Connect to the startup path in Registry
            key = winreg.OpenKey(
                winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, winreg.KEY_ALL_ACCESS)

            # remove persepolis from startup
            winreg.DeleteValue(key, 'persepolis')

            # Close connection
            winreg.CloseKey(key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号