catalin20
catalin20

Reputation: 33

How to run jess file (.clp file) from windows CMD/ .bat file?

How to run a .clp file (jess) in windows cmd / .bat file? My current file looks like that:

(deftemplate Tree (slot current_node)(slot node_childrens))

(assert (Tree (current_node A)(node_childrens B,C,D)))
(assert (Tree (current_node B)(node_childrens E)))
(assert (Tree (current_node C)(node_childrens F,G)))

(defrule display_data
    
    (Tree (current_node ?cn))
    =>
    (printout t ?cn " ")
)

(run)

After running that the output in console looks like this:

C B A

How I can run that file from windows cmd and see the output there? For example if I have a python file called "myfile.py" I can run that with following command:

python myfile.py

How I can run a jess file in windows cmd / from a .bat file?

Upvotes: 0

Views: 154

Answers (1)

Pentium1080Ti
Pentium1080Ti

Reputation: 1056

To run python myfile.py inside of a batch file you could do:

myscript.bat:

path/to/python/executable path/to/python/file.py
pause

However if you have the clips command line tool installed you can do this:

script.bat

(load myfile.clp)
(reset)
(run)

And then call it using clips -f2 script.bat which can also be called from a batch file.

Upvotes: 0

Related Questions