我如何从 vb.net 调用 vbs 脚本 [英] how do i call a vbs script from vb.net

查看:24
本文介绍了我如何从 vb.net 调用 vbs 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 vb.net 执行 vbs 脚本.我希望能够传递参数并等待脚本完成,然后再继续使用 .net 代码.

I am trying to execute a vbs script from vb.net. I want to be able to pass an argument as well as wait for the script to finish before continuing with the .net code.

在 vb6 中我会这样写:

In vb6 I would write it like this:

Public ws, rv
rv = ws.Run(exePath & "sleep04.vbs 123", 1, True)

推荐答案

使用 Process 类:

var p = Process.Start(exePath & "sleep04.vbs", "123")
p.WaitForExit();

这篇关于我如何从 vb.net 调用 vbs 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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