Call VB script using c++ program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lloydm
    New Member
    • Feb 2007
    • 22

    Call VB script using c++ program

    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.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by Lloydm
    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?

    Comment

    • Lloydm
      New Member
      • Feb 2007
      • 22

      #3
      Originally posted by sicarie
      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

      Comment

      • Lloydm
        New Member
        • Feb 2007
        • 22

        #4
        Still searchine... Anyone?

        Comment

        • sicarie
          Recognized Expert Specialist
          • Nov 2006
          • 4677

          #5
          Originally posted by Lloydm
          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.

          Comment

          • Lloydm
            New Member
            • Feb 2007
            • 22

            #6
            Originally posted by sicarie
            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<iostre am>
            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:\\Win dows\\Notepad.e xe");

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

            //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;
            }

            Comment

            Working...