windows#

Classes#

SW

Enum where members are also (and must be) ints

ERROR

Enum where members are also (and must be) ints

Functions#

get_free_space_on_windows(dir_name)

is_admin_on_windows()

_wait_and_close_handle(process_handle)

Waits until spawned process finishes and closes the handle for it.

run_as_admin(args[, wait])

Run command line argument list (args) with elevated privileges.

Attributes#

PHANDLE

PHANDLE#
class SW#

Bases: enum.IntEnum

Enum where members are also (and must be) ints

HIDE = 0#
MAXIMIZE = 3#
MINIMIZE = 6#
RESTORE = 9#
SHOW = 5#
SHOWDEFAULT = 10#
SHOWMAXIMIZED = 3#
SHOWMINIMIZED = 2#
SHOWMINNOACTIVE = 7#
SHOWNA = 8#
SHOWNOACTIVATE = 4#
SHOWNORMAL = 1#
class ERROR#

Bases: enum.IntEnum

Enum where members are also (and must be) ints

ZERO = 0#
FILE_NOT_FOUND = 2#
PATH_NOT_FOUND = 3#
BAD_FORMAT = 11#
ACCESS_DENIED = 5#
ASSOC_INCOMPLETE = 27#
DDE_BUSY = 30#
DDE_FAIL = 29#
DDE_TIMEOUT = 28#
DLL_NOT_FOUND = 32#
NO_ASSOC = 31#
OOM = 8#
SHARE = 26#
get_free_space_on_windows(dir_name)#
is_admin_on_windows()#
_wait_and_close_handle(process_handle)#

Waits until spawned process finishes and closes the handle for it.

run_as_admin(args, wait=True)#

Run command line argument list (args) with elevated privileges.

If wait is True, the process will block until completion.

Notes

  • no stdin / stdout / stderr pipe support

  • does not automatically quote arguments (i.e. for paths that may contain spaces)

See: - http://stackoverflow.com/a/19719292/1170370 on 20160407 MCS. - msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx - ContinuumIO/menuinst - saltstack/salt-windows-install # NOQA - twonds/twisted - https://stackoverflow.com/a/19982092/2127762 - https://www.codeproject.com/Articles/19165/Vista-UAC-The-Definitive-Guide - JustAMan/pyWinClobber