LoginSignup
7
8

More than 5 years have passed since last update.

バッチファイル(*.bat) を管理者として実行するための VBScript

Last updated at Posted at 2015-11-04
runas.vbs
Set objShell=CreateObject("Shell.Application") 
   objShell.ShellExecute "cmd.exe", _
   """" & "/k e:\runas.bat" & """", _
   "", _
   "runas", _
   1
SYNTAX
Shell.ShellExecute( _
  ByVal sFile As BSTR, _
  [ ByVal vArguments As Variant ], _
  [ ByVal vDirectory As Variant ], _
  [ ByVal vOperation As Variant ], _
  [ ByVal vShow As Variant ] _
) As Integer

vOperation が肝で、ここに動詞"runas"を指定する。

7
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8