在提升的 cmd.exe 上运行脚本
使用以下脚本打开命令窗口后如何运行脚本?
Set objSh = CreateObject("Shell.Application")
objSh.ShellExecute "cmd.exe", "uac" , "", "runas", 1
例如,如何使用上述脚本以管理员身份运行 ipconfig
?
How do I ran a script after I open a command window using the below script?
Set objSh = CreateObject("Shell.Application")
objSh.ShellExecute "cmd.exe", "uac" , "", "runas", 1
For example, how do I run ipconfig
as an admin using the above script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果指定
/c
开关,则cmd.exe
将执行指定的命令,然后终止。因此,例如:
或者,您可以使用
/k
开关,其工作方式完全相同,只不过命令执行完成后它会在屏幕上保留命令提示符。If you specify the
/c
switch, thencmd.exe
will carry out the specified command and then terminate.So, for example:
Alternatively, you could use the
/k
switch, which works exactly the same way, except it keeps the command prompt on the screen once your command finishes executing.