This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Launch Chrome in unelevated state on Windows platform by using `wmic …
…call create`.
- Loading branch information
1 parent
8660c6a
commit 5ca41a7
Showing
4 changed files
with
110 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var objShell = new ActiveXObject("shell.application"); | ||
var objShellWindows = objShell.Windows(); | ||
if (objShellWindows != null) | ||
{ | ||
var fso = new ActiveXObject("Scripting.FileSystemObject"); | ||
var tempFile = WScript.Arguments(0); | ||
var file = fso.OpenTextFile(tempFile, 2, true, 0); | ||
file.WriteLine(""); | ||
file.Close(); | ||
|
||
// Build up the parameters for launching the application and getting the process id | ||
var command = "cmd"; | ||
var params = "/c \"wmic /OUTPUT:" + tempFile + " process call create \""; | ||
for (var i = 1; i < WScript.Arguments.length; i++) { | ||
params += WScript.Arguments(i) + " "; | ||
} | ||
params += "\"\""; | ||
|
||
for (var i = 0; i < objShellWindows.count; i++) | ||
{ | ||
var item = objShellWindows.Item(i); | ||
if (item) | ||
{ | ||
item.Document.Application.ShellExecute(command, params); | ||
break; | ||
} | ||
} | ||
} |