Files
deskflow/scripts/lib/windows.py
Nick Bolton ef31d3e21b Script to install deps (Windows only for now) (#7331)
* Script to install deps (Windows only for now)

* Set runner temp dir for choco

* Add missing os import

* Modify for CI

* Update CL

* Improve logging

* Update workflow to install deps via script

* Explain 3.1.1 version lock
2024-01-19 14:44:50 +00:00

16 lines
471 B
Python

import ctypes
import sys
def relaunch_as_admin(script):
args = ' '.join(sys.argv[1:])
command = f'{script} --pause-on-exit {args}'
print(f'Re-launching script as admin: {command}')
ctypes.windll.shell32.ShellExecuteW(None, 'runas', sys.executable, command, None, 1)
def is_admin():
"""Returns True if the current process has admin privileges."""
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except ctypes.WinError:
return False