Option Explicit
Dim u, p, c, sh, env, path, rc
u = "username"
p = "password" & Chr(13)
c = "command"
Set sh = CreateObject("WScript.Shell")
Set env = sh.Environment("Process")
path = env("SystemRoot")&"\System32\runas.exe"
rc = sh.Run("runas /user:" & u & " " & Chr(34) & c & Chr(34), 2, False)
Wscript.Sleep 30 'need to give time for window to open.
sh.AppActivate(path) 'make sure we grab the right window to send password to
sh.SendKeys p 'send the password to the waiting window.
Set env = Nothing
Set sh=Nothing
WScript.Quit