c++执行vbs脚本
程序员文章站
2022-06-26 15:11:17
...
#include<fstream>
using namespace std;
int main()
{
fstream out("StartIE.vbs",ios::out);
out<<"AppName=\"启动IE\"\n\
Set Wshell=WScript.CreateObject(\"WScript.Shell\")\n\
Set ie=WScript.CreateObject(\"InternetExplorer.Application\")\n\
ie.Navigate \"http://www.duba.com/\"\n\
ie.Visible=0\n";//注意:最后一句也要加个换行符'\n'
out.close();
system("StartIE.vbs");
system("del StartIE.vbs");
return 0;
}