|
|
|
@ -647,8 +647,12 @@ def OrchestratorRerunAsAdmin():
|
|
|
|
|
:return: True - Запущен с правами администратора; False - Не запущен с правами администратора
|
|
|
|
|
"""
|
|
|
|
|
if not OrchestratorIsAdmin():
|
|
|
|
|
# Re-run the program with admin rights
|
|
|
|
|
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
|
|
|
|
|
if "PYTHON_CONFIGURE" in os.environ:
|
|
|
|
|
# Re-run the program with admin rights
|
|
|
|
|
ctypes.windll.shell32.ShellExecuteW(None, "runas", "cmd", " ".join(["/C", "cd", f'"{os.getcwd()}"', "&&",f'"{os.environ["PYTHON_CONFIGURE"]}"',sys.executable]+sys.argv), None, 1)
|
|
|
|
|
else:
|
|
|
|
|
# Re-run the program with admin rights
|
|
|
|
|
ctypes.windll.shell32.ShellExecuteW(None, "runas", "cmd", " ".join(["/C", "cd", f'"{os.getcwd()}"', "&&", sys.executable,sys.argv]), None, 1)
|
|
|
|
|
else:
|
|
|
|
|
print(f"Уже запущено с правами администратора!")
|
|
|
|
|
|
|
|
|
|