如何从 Windows CMD/.bat 文件运行 jess 文件(.clp 文件)?

时间:2021-01-09 13:14:17

标签: java clips jess

如何在 windows cmd / .bat 文件中运行 .clp 文件 (jess)?我当前的文件看起来像这样:

(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)

运行后控制台输出如下:

C B A

如何从 windows cmd 运行该文件并查看那里的输出?例如,如果我有一个名为“myfile.py”的 python 文件,我可以使用以下命令运行它:

python myfile.py

如何在 windows cmd 中/从 .bat 文件运行 jess 文件?

1 个答案:

答案 0 :(得分:0)

要在批处理文件中运行 python myfile.py,您可以:

myscript.bat:

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

但是,如果您安装了 clips 命令行工具,您可以这样做:

脚本.bat

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

然后使用 clips -f2 script.bat 调用它,它也可以从批处理文件中调用。