Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Run .Bat External task

hi all,

 

I am trying to set up an external task to run .bat file from the qmc but not working for me nor I can see why.

I am able to run the task by double clicking to it using the Qlik service account with no issues. Any idea what do I need t do differently?

alec1982_0-1715021712882.png

 

Labels (2)
8 Replies
igoralcantara
Partner - Specialist
Partner - Specialist

Can you specify what "not working" means?

Is it not running at all? 

Is it not executing what it should?

Does it give an error message?

Do you have log files associated to this task? 

Check out my latest posts at datavoyagers.net
rodrigo_martins
Partner - Creator
Partner - Creator

I had a similar problem once. Have you tried putting the full path in the task parameter? Instead of EXECUTE Test.bat try putting EXECUTE F:\ExternalTasks[...]\Test.bat

alec1982
Specialist II
Specialist II
Author

QMC is gives "failed" but cannot see any other details.

alec1982
Specialist II
Specialist II
Author

 can I locate the log file of the external tasks?

NadiaB
Support
Support

Hi@alec1982 

By any chance was this configured ?

https://help.qlik.com/en-US/sense/May2023/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptRegularSt...

If try the following does it work ?

Execute cmd.exe /c "c:\sw\sample.bat"

 

Kind Regards.

 

Don't forget to mark as "Solution Accepted" the comment that resolves the question/issue. #ngm
Levi_Turner
Employee
Employee

Levi_Turner_0-1715096662474.png

 

Path: C:\Windows\System32\cmd.exe

Parameters: /C C:\temp\example.bat

This works for me. On a multi-node setup, you'd want to host the .bat on a share where the service account has permissions to the share (e.g. \\myserver\temp\example.bat).

cody_beaulieu
Partner - Contributor
Partner - Contributor

Hi Levi,

 

This unfortunately is not quite working for me, and I am hoping you could help me. I followed this format and my task seems to "stall" and not even run the .bat file. The task remains in "started" seemingly forever, and not touch the .bat file. Is this maybe a permissions thing? Please let me know your thoughts, thanks!

cody_beaulieu_1-1718285031906.png

 

cody_beaulieu_0-1718285024582.png

Cody Beaulieu

Wipfli LLP

Levi_Turner
Employee
Employee

Runs fine on my end. I would personally avoid using %USERS% paths since it does beg the question whether the service account has permissions to write there. On my test server, I do not get the UAC prompt when accessing my personal account's path but I have seen this on other servers. Best to rule this out by using another directory.

I have written some kludgy batch scripts before but by no means an expert. That being said I don't see the point of including the EXIT line. From here (https://ss64.com/nt/exit.html) it looks like a command to error handle. Qlik will end the process when the script finishes and since there's no interactivity, error handling needs to be handled in the script logic itself.