Javascript 具有模板文本的字符串中的字符串

Javascript 具有模板文本的字符串中的字符串,javascript,node.js,Javascript,Node.js,我想用javascript ecma6中的模板文本在字符串中创建一个字符串。是否可以将双引号或单引号添加到字符串中的tamplate Literal输出中。 我是使用path中字符串形式的目录输出作为字符串来解决这个问题的 let input = "C:\users\document" 我想child.stdin.write('athom项目--运行“C:\users\document”\n') 我来到这个child.stdin.write('athon项目--run“'+${input}+'

我想用javascript ecma6中的模板文本在字符串中创建一个字符串。是否可以将双引号或单引号添加到字符串中的tamplate Literal输出中。 我是使用path中字符串形式的目录输出作为字符串来解决这个问题的

let input = "C:\users\document"
我想
child.stdin.write('athom项目--运行“C:\users\document”\n')

我来到这个
child.stdin.write('athon项目--run“'+
${input}
+''C:\users\document\n')

在ecma6中没有更简洁的方法吗?

a由倒勾(`)分隔。您当前正在尝试使用单引号对其进行分隔

这样做:

let input = "C:\users\document";
child.stdin.write(`athom project --run "${input}"\n`);
A由倒钩(`)分隔。您当前正在尝试使用单引号对其进行分隔

这样做:

let input = "C:\users\document";
child.stdin.write(`athom project --run "${input}"\n`);

我这样写的:我来到这个child.stdin.write('athom项目--run“+
${input}
+'”C:\users\document\n')。代码编辑器删除了${input}周围的back tics。现在仍然如此。你给出的答案就是我想要的。我写了这样一句话:我找到了这个孩子.stdin.write('athom project--run“+
${input}
+'“C:\users\document\n”)。代码编辑器删除了${input}周围的back tics。现在仍然如此。你给的答案就是我想要的。