The following link explains the steps to be followed:
https://javaworklife.wordpress.com/2020/11/02/running-console-commands-from-intellij-plugin-actions/