Skip to content

Instantly share code, notes, and snippets.

@mitaken
Created June 8, 2013 12:51
Show Gist options
  • Select an option

  • Save mitaken/5735086 to your computer and use it in GitHub Desktop.

Select an option

Save mitaken/5735086 to your computer and use it in GitHub Desktop.
D&Dしたファイルを管理者権限で開きます hostsファイルを編集するときなどに便利です。
Option Explicit
'起動するアプリケーション
Const CstStrLaunchApplication = "notepad.exe"
'Const CstStrLaunchApplication = "C:\Program Files\Hidemaru\Hidemaru.exe"
If WScript.Arguments.Count = 0 Then
WScript.Quit
End If
Dim ObjShell
Set ObjShell = WScript.CreateObject("Shell.Application")
Call ObjShell.ShellExecute(CstStrLaunchApplication, """" & WScript.Arguments(0) & """", "", "runas")
Set ObjShell = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment