How to execute Cypher in a file?

Dinesh picture Dinesh · Jul 4, 2013 · Viewed 22.3k times · Source

I am working on windows. I have created a text file of Cypher query using notepad. How can I run the query in the file using Neo4jShell or Neo4j web interface console.

Answer

kmario23 picture kmario23 · Oct 13, 2014

On Debian/Ubuntu or any *nix installations, use the following from terminal:

$ neo4j-shell -c < path-to-cypher-query-file.cql

Note that each cypher query in the file must end in a semicolon and must be separated by a blank line from the other query. Also, the .cql ending (file format) is not mandatory.