Raise the NodeJS / Electron process on Windows

I am currently building an application in Electron / NodeJS and am at the point where I need to elevate privileges on Windows in order to perform a specific task (only problem with Win7 +). How can I do this programmatically? I will even take on the execution of the bash script if it does the job. Thanks!

+7
source share
2 answers

To increase UAC, use the runas module: https://www.npmjs.com/package/runas

+5
source

I was writing to a file using the 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"''); 
0
source

All Articles