简体   繁体   中英

can i save from delete double quotes at vscode task.json?

Problem

I want to compress project files with ziplist.txt. but then need double quotes in the 7zip command. like this, "\"@ziplist.txt\"" . as a result, double quotes are deleted. so tell me what to do if you know how to.

Vscode Task Settings

{
    // 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
            }
        }
    ]
}

Error messages


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.

Changed the double quotes used inside to single quotes. This will work.

It's all. Thanks.

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
            }
        }
    ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM