我怎么能得到一个批处理文件来执行一个 vbs? [英] How could I get a batch file to execute a vbs?

查看:29
本文介绍了我怎么能得到一个批处理文件来执行一个 vbs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮我从批处理文件中执行 vbs?我正在尝试执行此

Can anyone help me execute a vbs from a batch file? I am trying to execute this

''''Script to create manual system restore point without user intervention''''

If WScript.Arguments.Count = 0 Then

Set objShell = CreateObject("Shell.Application")

objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1

Else

GetObject("winmgmts:\\.\root\default:Systemrestore").CreateRestorePoint "ManualRestorePoint", 0, 100

End If

推荐答案

如果将上述脚本另存为 myscript.vbs,则可以从批处理文件中将其调用为 wscript myscript.vbs.

If you save the above script as myscript.vbs, you can call it from a batch file as wscript myscript.vbs.

您可能想要运行 wscript/? 以查看是否要传递任何标志来抑制横幅等.

You might want to run wscript /? to see if you want to pass any flags to suppress the banner, etc.

这篇关于我怎么能得到一个批处理文件来执行一个 vbs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆