You can use the ShellExecute method of the Windows Shell object instead, and use the runas
operation.
Set Shell = CreateObject("Shell.Application")
Shell.ShellExecute "Start.bat", , , "runas", 0
This will request elevation and run Start.bat
.
ShellExecute's arguments are (excerpted and summarized from the ShellExecute page on MSDN):
- sFile [in] - String of the filename to perform the operation on
- vArguments [in, optional] - String of arguments (command line arguments)
- vDirectory [in, optional] - The fully qualified path of the directory that contains the file specified by sFile. If this parameter is not specified, the current working directory is used.
- vOperation [in, optional] - The operation to be performed. If this parameter is not specified, the default operation is performed.
- vShow [in, optional] - Initial window display recommendation. 0 for hidden.
If you absolutely have to use cmd /c
to run the batch file, you'll need to specify the full path to it. The invocation would look something like this:
Set Shell = CreateObject("Shell.Application")
Shell.ShellExecute "cmd", "/c F:\ull\path\to\Start.bat", , "runas", 0