Created
April 11, 2015 19:36
-
-
Save hymkor/6148dc1aecdc78d83add to your computer and use it in GitHub Desktop.
コマンドラインから管理者権限でコマンドを実行するバッチファイル(JScript)
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
@if (0) == (0) echo off | |
cscript //nologo //E:JScript "%~f0" %* | |
exit /b 0 | |
@end | |
var program = "CMD.EXE"; | |
var argv=""; | |
var args = WScript.Arguments; | |
if( args.length >= 1 ){ | |
program = args.Item(0); | |
if(args.length >= 2 ){ | |
argv = args.Item(1); | |
for(var i=2 ; i < argv.length ; i++ ){ | |
argv = argv + " " + args.Item(i); | |
} | |
} | |
} | |
var shellApp = new ActiveXObject("Shell.Application"); | |
shellApp.ShellExecute(program,argv,"","runas"); | |
// vim:ft=javascript: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Move to https://github.com/zetamatta/Jatchfiles