【问题标题】:can i save from delete double quotes at vscode task.json?我可以从 vscode task.json 的删除双引号中保存吗?
【发布时间】:2020-12-14 02:13:11
【问题描述】:

问题

我想用 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\7\pwsh.exe -Command 7z a ./release.zip "@ziplist.txt"" terminated with exit code: 1.

【问题讨论】:

    标签: visual-studio-code vscode-settings 7zip vscode-tasks


    【解决方案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
                }
            }
        ]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-08
      • 1970-01-01
      • 2015-07-26
      • 1970-01-01
      • 1970-01-01
      • 2013-10-09
      • 2020-02-18
      相关资源
      最近更新 更多