1

I am trying to run a .vbs script on server side via code (HTML Item) on Cognos Report Studio. I have already tried using <a href="..\samples\scripts\script.vbs"> button </a> but it just opens the script text on browser.

I have tried this code below using PHP, but it did not work:

<?php
    function runScript(){
        exec("samples\scripts\script.vbs");
        echo("done");
    }
?>

<a href=# onclick="runScript();">

How could I do that?

EDIT: Both client and server are Windows machines.

4
  • Maybe duplicate : Run VBScript on server from javascript/php Commented Nov 12, 2015 at 12:52
  • I have tried the solution using 'wscript "../samples/scripts/script.vbs"' but it did not work too Commented Nov 12, 2015 at 13:02
  • Are you working on Unix or Windows ? Commented Nov 12, 2015 at 13:03
  • Windows, client and server are Windows Commented Nov 12, 2015 at 13:04

1 Answer 1

0

I think you do it the wrong way. Create 2 files :

I assume you activated COM class.

Page launcher.php :

<a href="executeVbScript.php">Execute VB</a>

Page executeVbScript.php

exec('wscript "C:/samples/scripts/script.vbs"');

Start with launcher.php page.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you. I know I can create the executeVbScript.php on server, but I don't know if Cognos' HTML items are saved as .php files or .HTML files. I'll try it and if it works I'll mark it as answered.
You mean the script must be run on client ?
No, the vbs must be run on server. I just don't know yet if Cognos' HTML items accept php commands. When I ran it the commands did not show up at the page, so I think it accepts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.