Run / call bat file?

Can we run call a bat file ?

Code tried:
“CreationDate”: “2018-7-8”,
“Commands”: [
“Command”: “storeEval”,
“Target”: “var wshShell = new ActiveXObject(“WScript.Shell”); wshShell.Run(“C:\\Selenium\\order.bat”);”,
“Value”: “order”
“Command”: “echo”,
“Target”: “${order}”,
“Value”: “”

Getting Error: Error in runEval code: ActiveXObject is not defined

You can not call a bat file from within the Kantu macro, but you can call the macro from a bat file.

Does this solve your question/task?

Update: Now there is a workaround. You can use XType to send this key sequence:

  • xtype | ${KEY_WIN+KEY_R} - open run box
  • xtype | order.bat - your batch file
  • xtype | ${KEY_ENTER} - run it

Hi @admin

The path of batch file where must add to find the bat file ?

If the path have space need escape ?

Can you post an example with bath file with path with space, please.


Here are some examples:

Can you post an example with bath file with path with space, please.

Since the Kantu “command line” is actually a URL with paramters, you must replace " " (space) with %20.

Hi @ulrich

I need an information. to run firefox with kantu macro i need to have macro save in hard disk with xmodule or i can run with a batch file all kantu macros saved in html5 storage too or i need before export the macro to html with autorun ?

I’m confused about batch file and relations of
-) Macro saved in html5
-) Macro saved in json in my hard disk with xmodule
-) Macro exported in html with autorun

I do not understand well how to set the path of the kantu macro in batch file.

In the example linked i look

“C:\Program Files\Mozilla Firefox\firefox.exe” “file:///D:/test/c.html?macro=demoframes&cmd_var1=hello%21world&cmd_var2=123&cmd_var3=ABC&direct=1&savelog=logfirefox.txt”

But i do not know this path “file:///D:/test/c.html” can you help me ?

“c.html?macro=demoframes” wath is ?

Thanks for help me

Good question.

c.html = any exported macro with the autorun Javascript code. What macro you use does not matter!!!, because we overwrite the embedded macro with macro=demoframes - so demoframes is the macro that we will run. “c.html” is just a dummy website that is used to launch the browser and Kantu.

How to create c.html: Export any macro as HTML + autorun:


1 Like

Thanks for the explanation I try this kantu function that I didn’t know, thanks again.

Have a nice day

Working like a charms, thanks