• Python 获取windows管理员权限办法


    from __future__ import print_function
    import ctypes, sys, os
    
    
    def is_admin():
        try:
            return ctypes.windll.shell32.IsUserAnAdmin()
        except:
            return False
        
    if is_admin():
        os.startfile("system-jg_new.exe")
    else:
        if sys.version_info[0] == 3:
            ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1)
            os.startfile("system-jg_new.exe")
        else:  # in python2.x
            ctypes.windll.shell32.ShellExecuteW(None, u"runas", unicode(sys.executable), unicode(__file__), None, 1)
    View Code
  • 相关阅读:
    OCR中表格识别及WORD生成
    太阳能跟踪系统
    QA300太阳能移动电源
    OCR之表格识别
    2012112
    2012123
    2012121
    2011101
    201191
    2011828
  • 原文地址:https://www.cnblogs.com/leigepython/p/10532321.html
Copyright © 2020-2023  润新知