‘Command Line’ Run Configuration功能要求.
Pycharm在线帮助的Run/Debug Configurations部分列出了所有支持的运行/调试配置类型,并且不支持shell脚本.
但是,您可以通过安装插件来添加此类支持.例如,如果您对bash脚本感兴趣,则会在运行/调试配置中添加支持运行shell脚本的BashSupport插件.
从插件的主页:
BashSupports can directly run scripts within IntelliJ. You can create
a new run configuration for Bash scripts. Here you can set which
interpreter is used to run it. Whenever a script is executed the
output is logged. If Bash prints out Syntax errors then the errorneous
lines are clickable to jump to the location of the error.
对于Windows,有CmdSupport插件提供了运行.cmd脚本的操作.它似乎不支持运行这样的脚本,如运行/调试配置.
作为一种解决方法,您可以使用Python运行/调试配置,指定一些虚拟(空)Python文件运行,并使用“启动前”选项指定外部工具,并在添加/配置此外部工具时指定脚本路径.详见In IntelliJ IDEA,how can I create a key binding that executes a shell script with the current file as a parameter?.
由于PyCharm是基于IntelliJ的IDEA平台,所以问题IntelliJ IDEA: Running a shell script as a Run/Debug Configuration是非常相关的.
说到运行/调试配置,你可能对插件Run Configuration as Action感兴趣
(…) provides a way to use run configurations as buttons on toolbar. Or assign shortcuts to execute specific run configuration.