2012-09-26 15:25
浏览 95


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 );
    } else { 
        echo 'can not create wshell object'; 
    } // end if

    $obj = null;

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

图片转代码服务由CSDN问答提供 功能建议

我们必须运行一个vbscript,将自定义Web应用程序中收集的信息合并到我们的管理软件中。 .vbs与CodeIgniter 2中构建的Web应用程序位于同一文件夹中。


   public function saveToPM($ budgetType){
 $ obj = new COM('WScript.Shell');  
 if(is_object($ obj)){
 $ obj-> Run('cmd / C wscript.exe D:\ pamtest \ myload.vbs',0,true); 
 var_dump($ obj  - >运行); 
} else {
} //结束如果
 $ obj = null; 
 // $ this-> load-> view('goodPush'); 
} //结束saveToPM函数


我借用了< a href =“http://www.sitepoint.com/forums/showthread.php?505709-run-a-vbs-from-php”rel =“nofollow”> http://www.sitepoint.com/forums/ showthread.php?505709-run-a-vbs-from-php 。

屏幕回显“代码已执行”但vbscript无法运行。 \ n


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题