【发布时间】:2017-11-21 19:03:04
【问题描述】:
我想在 sublime text 3 中编译我的 C++ 程序并在 cmd 中运行它。 为此,我创建了一个新的构建系统(Tools-->Build System)。
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": "true",
"variants":
[
{
"name": "Run",
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}" ,"&&","start", "cmd", "/k", "$file_base_name"],
"shell": true
}
] }
这会执行:
g++ file_location -o file_location && start cmd /k file_location
我想要实现的是(以便在执行完成后保持屏幕,并应在按 cmd 中的任意键时退出):
g++ file_location -o file_location && start cmd /c "file_location && pause>nul"
(即将k替换为c并实现双引号)
我试过\"
它没有传递",而是传递整个\",这会在cmd中产生错误。
我该怎么办?
【问题讨论】:
-
用引号引起来的意思是单引号吗?和双引号作为 双引号?
-
是的............
标签: c++ cmd g++ sublimetext2 sublimetext3