如何在C ++中运行.vbs并在执行.vbs文件后使用结果 [英] How to run .vbs in C++ and use the result after the execution of .vbs file
本文介绍了如何在C ++中运行.vbs并在执行.vbs文件后使用结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法从c ++程序运行.vbs文件。 PLZ帮我解决了这个问题。
我尝试了什么:
我无法从c ++程序运行.vbs文件。 PLZ帮助我解决问题。
I am not able to run .vbs file from c++ program. plz help me to solve the problem.
What I have tried:
I am not able to run .vbs file from c++ program. plz help me to solve the problem.
推荐答案
要运行VBS脚本,请参阅 Microsoft Windows 2000脚本指南 - 从命令行运行脚本 [ ^ ]。
要从C / C ++应用程序执行命令,请使用 system,_wsystem [ ^ ], _popen ,_wpopen [ ^ ]或 ShellExecute功能(Windows) [ ^ ]。
要获取脚本打印的数据,请将输出重定向到文本文件(请参阅第一个链接)并在之后读取该文件或使用_popen()
(参见_popen
MSDN链接中的示例)。
To run a VBS script see Microsoft Windows 2000 Scripting Guide - Running Scripts from the Command Line[^].
To execute a command from a C/C++ application use system, _wsystem[^], _popen, _wpopen[^] or the ShellExecute function (Windows)[^].
To get the data printed out by the script, redirect the output to a text file (see first link) and read that file afterwards or use_popen()
(see example at the_popen
MSDN link).
您可以使用COM在C ++中托管vbs脚本引擎和 Windows脚本引擎 [ ^ ]
如果你对COM有很好的掌握,这并不是特别困难
you can host a vbs script engine inside C++, using COM and Windows Script Engines[^]
It's not particularly difficult, if you have a good grasp of COM
这篇关于如何在C ++中运行.vbs并在执行.vbs文件后使用结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文