Thread: Running a VBS script int C without command window

  1. #1
    Registered User
    Join Date
    Dec 2014
    Posts
    143

    Running a VBS script int C without command window

    I have created an scientific calculator application and I have a VBS script that runs some of the files. I want to create a C program that runs that VBS script. I can do this pretty easily, however, a command window flashes before the application opens. This problem is very annoying.

    So basically I need a short C (or C++) program that runs a VBS script without a command window popping up. I am on Windows 8 and my compiler is GCC/G++ under cygwin. Here is what I have now that DOES NOT work.

    Code:
    #include <windows.h>
    
    int main()
    {
        ShellExecute( NULL, NULL, "StartUp.vbs", NULL, NULL, SW_HIDE);
        return 0;
    }

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    You could try this:
    Code:
    ShowWindow( GetConsoleWindow(), SW_HIDE );
    With Visual Studio you can create a non console application which will not create a console window at all, but I'm not sure if cygwin supports the same functionality.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    Registered User
    Join Date
    Dec 2014
    Posts
    143
    Quote Originally Posted by bithub View Post
    You could try this:
    Code:
    ShowWindow( GetConsoleWindow(), SW_HIDE );
    With Visual Studio you can create a non console application which will not create a console window at all, but I'm not sure if cygwin supports the same functionality.
    Where are you saying to put this at?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Execute system command/script/etc. (Linux)
    By cnewbie1 in forum C Programming
    Replies: 5
    Last Post: 12-22-2009, 04:47 PM
  2. background jobs running inside a bash script
    By lehe in forum Linux Programming
    Replies: 8
    Last Post: 08-02-2009, 04:40 PM
  3. Batch Script Command
    By Tonto in forum Tech Board
    Replies: 2
    Last Post: 11-20-2008, 07:33 AM
  4. using tar command in a shell script
    By rohan_ak1 in forum Linux Programming
    Replies: 1
    Last Post: 05-10-2008, 07:03 AM
  5. Running 'exec' twice in one UNIX shell script
    By Zughiaq in forum Tech Board
    Replies: 2
    Last Post: 05-03-2003, 12:04 AM