Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:58:25+00:00 2026-06-11T22:58:25+00:00

There is a vbscript that we must run to consolidate information gathered in a

  • 0

There is a vbscript that we must run to consolidate information gathered in a custom web application into our management software. The .vbs is in the same folder as the web application which is built in CodeIgniter 2.

Here is the controller code:

public function saveToPM( $budgetType ){
    // run it 
    $obj = new COM( 'WScript.Shell' ); 

    if ( is_object ( $obj ) ) { 
        $obj->Run( 'cmd /C wscript.exe D:\pamtest\myload.vbs', 0, true );
        var_dump($obj->Run);
    } else { 
        echo 'can not create wshell object'; 
    } // end if

    $obj = null;

    //$this->load->view('goodPush');
} // end saveToPM function

We have enabled DCon in the php.ini file and used dcomcnfg to enable permissions for the user.

I borrowed the code from http://www.sitepoint.com/forums/showthread.php?505709-run-a-vbs-from-php.

The screen echos “Code executed” but the vbscript does not run.

We have been fighting with this for a while so any help is GREATLY appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:58:26+00:00Added an answer on June 11, 2026 at 10:58 pm

    It’s a bit messy. PHP calls WScript.Shell.Run which will call cmd (with /c – i.e terminate cmd.exe when it’s done its thing) which will call cscript.exe to run and interpret a .vbs. As you can see quite a few things that have to go right! 🙂

    What if you ‘wait’ for the WScript.Shell.Run call to end (your $wait variable) before continuing execution of the wsh script which will in turn allow PHP to continue execution etc?

    Since you’re not waiting for the call to finish, PHP thinks its all good and continues onto the next line (interpreted language).

    Also, maybe have the .vbs create an empty text file? Just so you have an indication that it has actually run.

    Just take a step back, have a beer and it’ll come to you! Gogo troubleshoot!

    And – http://ss64.com/vb/run.html

    If bWaitOnReturn is set to TRUE, the Run method returns any error code returned by the application.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Or any other normal scripting language for that matter. I know there is VBScript
Is there a way to work with numbers that are larger than VBScript's Long
There's a Rails 3.2.3 web application which doesn't use any database. But in spite
Is there a macro, VBA code or VBScript that I can write to edit
I have a classic ASP/VBScript application that needs to call methods in a Java
I have a custom built CRM that is 99% written in Classic ASP/VBScript. Currently
There is some old legacy vbscript code we have that needs some sort of
There is a VBScript (.vbs) script that someone made here at my company. It
I am developing an HTA that will run as a kiosk in our reception
I have some legacy XSLT scripts that incorporate VBScript in them. They are run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.