Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gunji767
Contributor
Contributor

How to call a bat files by using jscript in qlikview?

Dear All,

I am trying to call bat files using macros with the help of j script. But while trying to run the program exception is happens. Below is the jscript code i have used in macros.

<html>

<head>

<title>Run Exe or Bat files from HTA by Hackoo</title>

<HTA:APPLICATION

  APPLICATIONNAME="Run Exe or Bat files from HTA by Hackoo"

  ID="MyHTMLapplication"

  VERSION="1.0"/>

</head>

<script>

function RunExe(){

    var shell = new ActiveXObject("WScript.Shell");

    var path = '"D:/run.bat"';

    shell.run(path,1,false);

}

</script>

<input style="width: 170px; height:23px; color: white; background-color: #203040;

font-family:Book Antiqua;" type="button" Value="bat" onClick="RunExe();"

</html>

14 Replies
PrashantSangle

No need to write in macro.

In qlikview script you can use it.

see help menu for how to use EXECUTE..

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Anil_Babu_Samineni

Now Question to you

1) Why are you looking / calling thru Macro for that Bat file rather we have direct EXECUTE function.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
gunji767
Contributor
Contributor
Author

I want to run the bat file through button. It should not be on every reload.

gunji767
Contributor
Contributor
Author

Hi Prasanth,

Thanks for your help, it is working fine at script level. But i want to run the bat file through button. It should not be on every reload.

Anil_Babu_Samineni

Read this - run batch-file via button

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful