I'm currently building an app in Electron/NodeJS and am at a point where I'll need to elevate privileges on Windows to do a specific task (only Win7+ are a concern). How can I do this programmatically? I'll even take executing a bash script if it gets the job done. Thanks!
I'm currently building an app in Electron/NodeJS and am at a point where I'll need to elevate privileges on Windows to do a specific task (only Win7+ are a concern). How can I do this programmatically? I'll even take executing a bash script if it gets the job done. Thanks!
Share Improve this question edited Jul 23, 2015 at 14:04 Dustin asked Jul 23, 2015 at 12:56 DustinDustin 6,29719 gold badges63 silver badges93 bronze badges2 Answers
Reset to default 5In order to UAC elevate, use the runas
module: https://www.npmjs./package/runas
I did some file writes using use node-powershell module :node-powershell
const ps = new Shell({
executionPolicy: 'Bypass',
noProfile: true
});
ps.addCommand(`Start-Process -WindowStyle hidden cmd -Verb RunAs -ArgumentList '/c mkdir "C:\\Program Files\\foo"'`);