我可以从 vscode task.json 处删除双引号保存吗?
can i save from delete double quotes at vscode task.json?
问题
我想用 ziplist.txt 压缩项目文件。但是在 7zip 命令中需要双引号。像这样,"\"@ziplist.txt\""
。结果,双引号被删除。
如果你知道该怎么做,请告诉我该怎么做。
Vscode 任务设置
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "compress",
"type": "shell",
"command": "7z",
"args": [
"a",
"./release.zip",
"\"@ziplist.txt\""
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
错误信息
ParserError:
Line |
1 | 7z a ./release.zip @ziplist.txt
| ~~~~~~~~
| The splatting operator '@' cannot be used to reference variables in an expression. '@ziplist' can be used only as an argument to a command. To
| reference variables in an expression using '$ziplist'.
The terminal process "C:\Program Files\PowerShell\pwsh.exe -Command 7z a ./release.zip "@ziplist.txt"" terminated with exit code: 1.
将内部使用的双引号更改为单引号。这会起作用。
就这些了。谢谢
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "compress",
"type": "shell",
"command": "7z",
"args": [
"a",
"./release.zip",
"'@ziplist.txt'"
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
问题
我想用 ziplist.txt 压缩项目文件。但是在 7zip 命令中需要双引号。像这样,"\"@ziplist.txt\""
。结果,双引号被删除。
如果你知道该怎么做,请告诉我该怎么做。
Vscode 任务设置
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "compress",
"type": "shell",
"command": "7z",
"args": [
"a",
"./release.zip",
"\"@ziplist.txt\""
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
错误信息
ParserError:
Line |
1 | 7z a ./release.zip @ziplist.txt
| ~~~~~~~~
| The splatting operator '@' cannot be used to reference variables in an expression. '@ziplist' can be used only as an argument to a command. To
| reference variables in an expression using '$ziplist'.
The terminal process "C:\Program Files\PowerShell\pwsh.exe -Command 7z a ./release.zip "@ziplist.txt"" terminated with exit code: 1.
将内部使用的双引号更改为单引号。这会起作用。
就这些了。谢谢
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "compress",
"type": "shell",
"command": "7z",
"args": [
"a",
"./release.zip",
"'@ziplist.txt'"
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}