VBScript- Single line as administrator

落爺英雄遲暮 提交于 2019-12-04 15:11:37
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "cmd.exe", , , "runas", 1
oShell.Run "nodepad.exe"

(Source: http://social.technet.microsoft.com/Forums/eu/ITCG/thread/310e57f9-2367-4293-9f97-53d0e077aacc)

(More Info: http://ss64.com/vb/shellexecute.html)

Windows (from XP through to Win7 at least) has a runas command which does what you need. See here for details.

So, instead of running cmd.exe, you would run runas.exe, giving cmd.exe as the program to run.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!