Thread: c++ and vbs

  1. #1
    Registered User tekhawk's Avatar
    Join Date
    Aug 2006
    Location
    USA Ca
    Posts
    25

    c++ and vbs

    i was tring to run some of my vbs scripts from a c++ program using system
    i had no luck does anyone know a alternitive way of doing this
    Web Devlopment is fun http://tekhawk.com

    Dur Ritter Von Gott

    OpenSource & Linux for Life!!!

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    CreateProcess()?

    It would help to know exactly what "had no luck" actually means. Compile errors? Runtime errors? Your computer caught fire? Bush was re-elected again?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Quote Originally Posted by itsme86
    CreateProcess()?

    It would help to know exactly what "had no luck" actually means. Compile errors? Runtime errors? Your computer caught fire? Bush was re-elected again?
    *rofl-like-a-little-girl*

    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    This should do the trick:
    Code:
    system("cscript \"C:\\Path\\To\\Your Script.vbs\"");
    If you wish to run your script as GUI (with message boxes) rather than on the console, you can use wscript. There are several options available with cscript which you can discover by typing "cscript /?" on the command line.

    As itsme86 said, CreateProcess can be a better option than using system. In this case the executable would be cscript and the command line would be as above.

Popular pages Recent additions subscribe to a feed