By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,097 Members | 912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,097 IT Pros & Developers. It's quick & easy.

Call VB script using c++ program

P: 22
Hi all,

I have googled and used about every search enginge I know of but came up with no results for this. I created a small C++ program to call a vbscript on a remote pc as well as write/append to a log file on local machine. Everything works fine except for me not having any code/syntax to call vbscript. If someone could lead me to a resource or reply if they have done it before, I would sincerely appreciate. Thanks to all in advance.
May 24 '07 #1
Share this Question
Share on Google+
5 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Hi all,

I have googled and used about every search enginge I know of but came up with no results for this. I created a small C++ program to call a vbscript on a remote pc as well as write/append to a log file on local machine. Everything works fine except for me not having any code/syntax to call vbscript. If someone could lead me to a resource or reply if they have done it before, I would sincerely appreciate. Thanks to all in advance.
Have you looked into the system() command?
May 25 '07 #2

P: 22
Have you looked into the system() command?

Thanks for replying but no, I have not looked into it. Any resources you have or may know of would be a plus to increase my knowledge? pLease share. Thanks in advance
May 30 '07 #3

P: 22
Still searchine... Anyone?
Jun 2 '07 #4

sicarie
Expert Mod 2.5K+
P: 4,677
Still searchine... Anyone?
Did you look at the link I sent? You said you hadn't look into it, but did you after I posted it? The system command should be able to do what you want.
Jun 3 '07 #5

P: 22
Did you look at the link I sent? You said you hadn't look into it, but did you after I posted it? The system command should be able to do what you want.

OK, I wanna say thanks a million. program is working.
To all here's sample code


#include<iostream>
using namespace::std;

string answer="1";

int main(){
do{
cout<<"\n\n Press 1 to browse the internet?: ";
cin >>answer;

if(answer == "1"){
cout<<"\n\n Please wait..."
<<"\n Opening Notepad, please wait.....\n";
//EXECUTE NOTEPAD
system("C:\\Windows\\Notepad.exe");

//LIST FOLDER CONTENTS
system("cls");
system("dir c:\\windows\\system");

//CREATE A DIRECTORY
system("cls");
cout<<"\n\n Creating directory 'USERS', please wait...";
system("mkdir Users");

cout<<"\n\n Program will now exit...\n"
<<" ";
system("pause");
exit(1);
}
else{
cout<<"\n " <<answer
<<" is not a valid answer, try again\n";
fflush(stdin);
cout<<" ";
system("pause");
system("cls");
}
}while(answer!="1");
return 0;
}
Jun 6 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.