Last active
August 29, 2015 14:08
-
-
Save hymkor/b74b7952aaf9dc1702be to your computer and use it in GitHub Desktop.
[VBScript] コマンドラインから UAC 昇格 ref: http://qiita.com/zetamatta/items/f3310533fcd5f25e7f3f
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
Option Explicit | |
Dim program | |
If WScript.Arguments.Count <= 0 Then | |
program = "CMD.EXE" | |
Else | |
program = WScript.Arguments(0) | |
End If | |
Dim argv : argv = "" | |
If WScript.Arguments.Count >= 1 then | |
Dim i | |
For i=1 To WScript.Arguments.Count-1 | |
argv = argv & " " & WScript.Arguments(i) | |
Next | |
End If | |
Dim shellApp : Set shellApp = CreateObject("Shell.Application") | |
shellApp.ShellExecute program,Trim(argv), "" , "runas" | |
Set shellApp = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment