Wednesday, 15 July 2015

vbscript - Run exe from vbs error -



vbscript - Run exe from vbs error -

i'm trying run executable vbscript. tried this:

oshell = createobject("shell.application") oshell.shellexecute("cmd.exe", , , "runas", 1) oshell.run("file.exe")

however, gives me sub error on sec line. did mistake?

i assume want execute file.exe elevated privileges , maintain window open.

vbscript:

set oshell = createobject("shell.application") oshell.shellexecute "cmd.exe", "/k file.exe", "", "runas", 1

note runas verb undocumented.

powershell:

start-process -filepath "cmd.exe" -argumentlist @("/k", "file.exe") -verb "runas"

vbscript

No comments:

Post a Comment