配置Notepad++直接运行Python、Perl、C、C++、Java
运行(F5),输入命令并保存
cmd /k python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT
cmd /k cd "$(CURRENT_DIRECTORY)" && python2 "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT (先切换到当前目录,否则打开文件可能会出现找不到的情况)
/k 后面跟cmd中类似的命令,可以是python、perl等(已经配置了环境变量,否则需要些完整路径,如:C:\Python34\python.exe)
$(FULL_CURRENT_PATH) Notepad++的宏定义,含义是当前文件的完整路径
ECHO. (或ECHO\) 打印换行
EXIT是退出 CMD.EXE 程序(命令解释程序)
PAUSE 暂停批文件的处理并显示消息.
C、C++编译并运行,类似
cmd /k gcc -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" "$(FULL_CURRENT_PATH)" && CLS && "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" & PAUSE & EXIT
cmd /k c++ -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" "$(FULL_CURRENT_PATH)" && CLS && "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" & PAUSE & EXIT
Java编译并运行
cmd /k javac "$(FULL_CURRENT_PATH)" && CLS && cd "$(CURRENT_DIRECTORY)" && java "$(NAME_PART)" & PAUSE & EXIT
KEEP LEARNING!