Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to call a batch file with parameters from qlikview

Hi All,

I need to call a batch file from qlikview script and also send 5 parameters to batch file. So can anyone send me the script .

I tried below script but didnt work .

Execute cmd.exe /C E:\Qvd to be pushed to Mysql\Textfile.bat 3313 DatamapLoad Deletemetemp;

where 3313 ,DatamapLoad and Deletemetemp are arguements to be passed to batch file .

1 Solution

Accepted Solutions
Andrea_Ghirardello

Try to use WScript.Arguments...

Dim obj

Set obj = CreateObject("WScript.Shell")

Set oArgs = wscript.Arguments

obj.Run "c:\test.bat " & oArgs(0), , TRUE

View solution in original post

13 Replies
vikasmahajan

Please explain in details what is exact you are looking for ?

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

Hi

I need to execute a bat file through Qlikview script. After relaod of the applicatio .bat file needs to execute.

Execute cmd.exe /c "E:\Qvd to be pushed to Mysql\Textfile.bat" works well.No issues uptill now. But when i try to pass the parameters to batch file ,it doesnt work .

When i execute the script through cmd it works fine .

That means issue is  with the qlikview. Does QV allow us to pass parameters to batch file in first palce ??

vikasmahajan

1. Qlikview Allows us to pass parametes along with batch file

2. You can execute the script through qvw  create new qvw2  in script edit

    type following commands

  EXECUTE cmd.exe /C C:\Export-Email-Automation\TriggerMacro.bat;

  EXIT SCRIPT;

moment when you reload qvw2  your batch job will execute .

Hope this you are looking for .

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Andrea_Ghirardello

Hi,

Try the WScript.Shell object.

The following is an example to run a preview report from NPrinting:

Shell script.png

The following example shows you how to run a batch file:

Shell script 2.png

Not applicable
Author

Hi Vikas,

The script which you sent works well. But now how will i send the parameters to TriggerMacro.bat file ?

vikasmahajan

Yes you can pass parameters to macros  Following command TriggerMacro is parameter passed.

"C:\Program Files\QlikView\QV.exe" /Vv TriggerMacro=0  "C:\Export-Email-Automation\Dashboard.qvw"

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

Hi

Sorry for the trouble , but can you give me the example using below script

EXECUTE cmd.exe /C C:\Export-Email-Automation\TriggerMacro.bat;

  EXIT SCRIPT;

I tried 1)EXECUTE cmd.exe /C "C:\Export-Email-Automation\TriggerMacro.bat" Parameter1 Parameter2;

         2)EXECUTE cmd.exe /C "C:\Export-Email-Automation\TriggerMacro.bat; Parameter1 Parameter2";

Both the  above scripts didnt work

i dont understand

"C:\Program Files\QlikView\QV.exe" /Vv TriggerMacro=0  "C:\Export-Email-Automation\Dashboard.qvw"

Can u explain it a bit .

Andrea_Ghirardello

Try to use WScript.Arguments...

Dim obj

Set obj = CreateObject("WScript.Shell")

Set oArgs = wscript.Arguments

obj.Run "c:\test.bat " & oArgs(0), , TRUE

Not applicable
Author

Andrea its not working ,,,

i tried

copied the below script in VBS file

Dim obj

Set obj = CreateObject("WScript.Shell")

Set oArgs = WScript.Arguments

obj.Run "E:\Qvd to be pushed to Mysql\Textfile.bat " & oArgs(0) & oArgs(1)& oArgs(2), , TRUE

and called the vbs file through button

But sadly not working