You wish to run DCS queries through command line
This is possilbe with the use of the sdcssquery tool present and the console installation location.
You will have to pass the username and password any query tool user, along with the template location to the sdcssquery tool through commandline.
The attached files provide the template for use of the tool, along with an example.