How to run python script with elevated privilege on windows

前端 未结 11 1553
臣服心动
臣服心动 2020-11-22 07:34

I am writing a pyqt application which require to execute admin task. I would prefer to start my script with elevate privilege. I am aware that this question is asked many ti

11条回答
  •  再見小時候
    2020-11-22 08:03

    I found a very easy solution to this problem.

    1. Create a shortcut for python.exe
    2. Change the shortcut target into something like C:\xxx\...\python.exe your_script.py
    3. Click "advance..." in the property panel of the shortcut, and click the option "run as administrator"

    I'm not sure whether the spells of these options are right, since I'm using Chinese version of Windows.

提交回复
热议问题