node child_process exec : run as administrator
Asked Answered
G

0

9

in node, thanks to child_process , I manage to launch visual studio .

 var vsExe = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\Common7\\IDE\\devenv.exe"';
        let commande = `${vsExe}`;
        var exec = require("child_process").exec;
        exec(commande, function callback(error, stdout, stderr) {
           //callback
        });

I would like to do the same thing but as if I had run it as administrator (as if I did a right click and choose 'run as administrator')

enter image description here enter image description here

Do you know ho to do it please?

Greece answered 23/3, 2020 at 11:23 Comment(3)
According to microsoft/terminal github, you can't elavate permissions to an open terminal: github.com/microsoft/terminal/issues/632 So, I suppose you can try running the code from an administrator termianl. (open CMD as administrator > $ node startCodeDevenv.js).Thermionic
Thank you. indeed I am using this workaroundGreece
@YanivPeretz can you elaborate about this workaround?Farfetched

© 2022 - 2024 — McMap. All rights reserved.