Escape ampersand and other characters special to PowerShell
This commit is contained in:
parent
394dac03cc
commit
a7338f638c
1 changed files with 7 additions and 1 deletions
8
index.js
8
index.js
|
@ -458,7 +458,13 @@ function WindowsElevate(instance, end) {
|
|||
// var command = 'cscript.exe //NoLogo "' + instance.pathElevate + '"';
|
||||
var command = [];
|
||||
command.push('powershell.exe');
|
||||
command.push('Start-Process "' + instance.pathExecute + '"');
|
||||
command.push('Start-Process');
|
||||
command.push('-FilePath');
|
||||
// Escape characters for cmd using double quotes:
|
||||
// Escape characters for PowerShell using single quotes:
|
||||
// Escape single quotes for PowerShell using backtick:
|
||||
// See: https://ss64.com/ps/syntax-esc.html
|
||||
command.push('"\'' + instance.pathExecute.replace(/'/g, "`'") + '\'"');
|
||||
command.push('-WindowStyle hidden');
|
||||
command.push('-Verb runAs');
|
||||
command = command.join(' ');
|
||||
|
|
Loading…
Reference in a new issue