Q:

SFDX force:data:tree:export Invalid SOQL Query When Using File Path to Supply Query

When using the sfdx force:data:tree:export command, the Salesforce Developer Documentation states you can specify a file path in place of an in-line typed query (either option would follow the -q flag).  I ran a simple query using the in-line version first :
sfdx:force:data:tree:export -q "SELECT Id FROM Account LIMIT 5" -d queries/accounts/ -u DevHub

And it created the json and path files without issue. 
However, when I tried to swap out the in-line query for a file path directed at accountsquery.file which contains the exact same query string, I keep getting the following error:
➜  testProject sfdx force:data:tree:export -q queries/accountsquery -d queries/accounts/ -u DevHub

ERROR:  Invalid SOQL query: "select id from account". 

Does the file need to be of a certain extension type?  Is the syntax somehow different when you specify a file path?  I'm not sure what I'm doing wrong, and I can't find an example of using the file path over an in-line string anywhere. 

A:

I just tried executing by create a simple file in a folder as shown in the below screenshot and below command worked fine
sfdx force:data:tree:export -q data/accounts/queryFile -d data/accounts/

My folder structure is as below and you can see i have a file shown in the editor

And you can see I have a file queryFile which does not have any extension . 
The command line results are fine . 
Looks like the file does not need to enclose query in double quotes and thats your issue .