我有Vb脚本,如何在我的.Net应用程序中执行这些Vb脚本。 [英] I Have Vb Scripts , How Can I Execute These Vb Scripts In My .Net Application.
本文介绍了我有Vb脚本,如何在我的.Net应用程序中执行这些Vb脚本。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有vb脚本,如何在我的.net应用程序中执行这些vb脚本。
hai我是.net和vb脚本的新手,它是一个紧急要求所以请帮帮我。
提前谢谢。
i have vb scripts , how can i execute these vb scripts in my .net application.
hai i am new to .net and vb scripts , its an urgent requirement so please help me.
thanks in advance.
推荐答案
你可以使用:
You can use:
System.Diagnostics.Process.Start(@"cscript //B //Nologo c:\<path>\myScriptFile.vbs");
</path>
请注意,您与应用程序中的脚本交互有限。
Please keep in mind that you will have limited interaction with the script from your application.
例如,请参见此处 [ ^ ] 。
See, for instance here[^].
如果您想认真使用WSH,请不要将脚本作为单独的进程运行。正如解决方案1正确解释的那样,您与该流程的交互将受到限制。而是在您的应用程序中链接Windows主机脚本模型。
为此,请添加对项目的引用。使用添加引用窗口选项卡COM,选择Windows主机脚本模型(wshom.ocx)。将为您的项目C#项目生成带有接口的包装器。您需要使用命名空间IWshRuntimeLibrary
。按照Windows脚本宿主文档。
-SA
If you want to use WSH seriously, don't run the script as a separate process. As Solution 1 correctly explained, your interaction with that process would be limited. Instead, link Windows Host Script Model in your application.
To do so, add a reference to your project. Use the tab "COM" of the "Add Reference Window", choose, "Windows Host Script Model" (wshom.ocx). The wrapper with the interface will be generated for your project C# project. You will need to use the namespaceIWshRuntimeLibrary
. Follow the Windows Script Host documentation.
—SA
这篇关于我有Vb脚本,如何在我的.Net应用程序中执行这些Vb脚本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文