elevator

Windows UAC elevation that just works

Showing:

Popularity

Downloads/wk

41

GitHub Stars

14

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

elevator

Windows UAC elevation that just works.

npm version dependencies Build status ![Gitter](https://badges.gitter.im/Join Chat.svg)

Description

This module is a thin wrapper around the awesome elevate.exe utility by kliu, which is a small C open source application with x64 and ia32 support that just works.

This module doesn't make use of NodeJS C/C++ bindings and instead relies on executing the .exe file direcly in a way that is electron friendly even when the application is packaged in an asar archive.

Of course, this means that this NodeJS module is subjected to the Windows versions and architectures such supports. Windows Vista (or newer) is required.

Installation

Install elevator by running:

$ npm install --save elevator

Documentation

elevator.execute(command, [options], callback)

This function will yield an Error containing a code that equals ELEVATE_CANCELLED if the elevation was cancelled by the user.

Kind: static method of elevator
Summary: Execute a command with UAC elevation
Access: public

ParamTypeDefaultDescription
commandArray.<String>command
[options]Object{}options
[options.terminating]BooleanLaunches a terminating command processor; equivalent to "cmd /c command".
[options.persistent]BooleanLaunches a persistent command processor; equivalent to "cmd /k command".
[options.doNotPushdCurrentDirectory]BooleanWhen using -c or -k, do not pushd the current directory before execution.
[options.unicode]BooleanWhen using -c or -k, use Unicode; equivalent to "cmd /u".
[options.hidden]BooleanWhen using -c or -k, start "cmd" in hidden mode.
[options.waitForTermination]BooleanWaits for termination; equivalent to "start /wait command".
callbackfunctioncallback (error, stdout, stderr)

Example

elevator.execute([ 'cmd.exe' ], {
  waitForTermination: true
}, function(error, stdout, stderr) {
  if (error) {
    throw error;
  }

  console.log(stdout);
  console.log(stderr);
});

elevator.executeSync(command, [options]) ⇒ String

This function will throw an Error containing a code that equals ELEVATE_CANCELLED if the elevation was cancelled by the user.

Kind: static method of elevator
Summary: Execute a command with UAC elevation (Sync)
Returns: String - stdout buffer
Access: public

ParamTypeDefaultDescription
commandArray.<String>command
[options]Object{}options
[options.terminating]BooleanLaunches a terminating command processor; equivalent to "cmd /c command".
[options.persistent]BooleanLaunches a persistent command processor; equivalent to "cmd /k command".
[options.doNotPushdCurrentDirectory]BooleanWhen using -c or -k, do not pushd the current directory before execution.
[options.unicode]BooleanWhen using -c or -k, use Unicode; equivalent to "cmd /u".
[options.hidden]BooleanWhen using -c or -k, start "cmd" in hidden mode.
[options.waitForTermination]BooleanWaits for termination; equivalent to "start /wait command".

Example

elevator.executeSync([ 'cmd.exe' ], {
  waitForTermination: true
});

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:

$ gulp lint

License

The project is licensed under the MIT license.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100