This visual basic script does 3 things.
~ Grabs the current directory of where .VBS is stored and takes a file name.
~ Runs the given file w/ Admin privileges. (doesn't prompt for UAC)
~ Runs the file silently, without the CMD you mention.
bElevate = False
if WScript.Arguments.Count > 0 Then If WScript.Arguments(WScript.Arguments.Count-1) <> "|" then bElevate = True
if bElevate Or WScript.Arguments.Count = 0 Then ElevateUAC
REM run the following script with admin privilages. start point.
Set fso = CreateObject("Scripting.FileSystemObject")
GetTheParent = fso.GetParentFolderName(Wscript.ScriptFullName)
Set WshShell = WScript.CreateObject ("WScript.Shell")
WshShell.Run GetTheParent & ("\CUSTOMNAMEOFBAT.bat")
WScript.Sleep 500
REM the above script will be run with admin privilages. end point.
Sub ElevateUAC
sParms = " |"
If WScript.Arguments.Count > 0 Then
For i = WScript.Arguments.Count-1 To 0 Step -1
sParms = " " & WScript.Arguments(i) & sParms
Next
End If
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "wscript.exe", WScript.ScriptFullName & sParms, , "runas", 1
WScript.Quit
End Sub
Copy/Paste the following code and save as .VBS. Put the .vbs script in the same directory as your .bat and change "CUSTOMNAMEOFBAT" (on end of line 11) to the name of your .bat.