8

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?

Pipo
  • 5,170
  • 7
  • 33
  • 66
  • According to microsoft/terminal github, you can't elavate permissions to an open terminal: https://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`). – Yaniv Peretz Feb 11 '22 at 22:40
  • Thank you. indeed I am using this workaround – Pipo Feb 14 '22 at 12:33

0 Answers0