microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.54k stars 29k forks source link

task.json with powershell doesn't accept / as argument #76119

Closed mhamri closed 5 years ago

mhamri commented 5 years ago

Issue Type: Bug

create a task using the powershell as default shell

{
            "label": "Compile-MQL",
            "type": "shell",
            "command": "C:\\Program Files (x86)\\Blueberry Markets  MetaTrader 4 Terminal\\metaeditor.exe",
            "args": [
                "/compile:\"${file}\""
            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },

the first problem is the space in the command. if i use gitbash this is not a problem but anyway...

if I use scape character it won't help "command": "\"C:\\Program Files (x86)\\Blueberry Markets MetaTrader 4 Terminal\\metaeditor.exe\"", if I use single quote I can manage to run the command itself "command": "'C:\\Program Files (x86)\\Blueberry Markets MetaTrader 4 Terminal\\metaeditor.exe'", `

so it become like this:

{
            "label": "Compile-MQL",
            "type": "shell",
            "command": "'C:\\Program Files (x86)\\Blueberry Markets  MetaTrader 4 Terminal\\metaeditor.exe'",
            "args": [
                "/compile:\"${file}\""
            ],
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": true,
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },

the next problem is the PowerShell, it is throwing error now for the forward slash in the argument. I tried to manually use a single quote, double quote, with argument object and weak, strong, escape quoting, all failed.

in powershell i can run this command like this

&'C:\Program Files (x86)\Blueberry Markets  MetaTrader 4 Terminal\metaeditor.exe' /compile:'c:\Users\iser\AppData\Roaming\MetaQuotes\Terminal\844F5A278A739F84AD1015D3BEBAC5E6\MQL4\Experts\LotCalculator\LotCalculator.mq4'

the problem is i don't have any method to user the call operation (&).

VS Code version: Code 1.35.1 (c7d83e57cd18f18026a8162d042843bda1bcf21f, 2019-06-12T14:30:02.622Z) OS version: Windows_NT x64 10.0.17763

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.89GB (3.54GB free)| |Process Argv|C:\Users\amrim\AppData\Roaming\MetaQuotes\Terminal\844F5A278A739F84AD1015D3BEBAC5E6\MQL4\Experts\LotCalculator| |Screen Reader|no| |VM|0%|
Extensions (54) Extension|Author (truncated)|Version ---|---|--- angular-material|1to|0.13.0 rainbow-brackets|2gu|0.0.6 angular-extension-pack|ale|1.0.0 vscode-angular2-files|ale|1.6.2 ng-template|Ang|0.800.0 angulardoc-vscode|Ang|6.1.3 vscode-browser-preview|auc|0.5.9 npm-intellisense|chr|1.3.0 path-intellisense|chr|1.4.2 angular-schematics|cyr|1.23.0 EditorConfig|Edi|0.13.0 tslint|eg2|1.0.43 vscode-npm-script|eg2|0.3.7 prettier-vscode|esb|1.9.0 auto-close-tag|for|0.5.6 auto-rename-tag|for|0.1.0 json2ts|Gre|0.0.6 angular2-switcher|inf|0.2.0 path-autocomplete|ion|1.13.3 angular-essentials|joh|0.6.3 Angular2|joh|8.1.1 vscode-peacock|joh|2.4.0 compilemql4|Kei|0.0.1 angular-extension-pack|loi|0.7.1 ts-extension-pack|loi|0.2.0 Angular2Tests|Mar|0.7.3 Angular-BeastCode|Mik|8.0.7 cpptools|ms-|0.23.1 csharp|ms-|1.20.0 powershell|ms-|2019.5.0 vscode-typescript-tslint-plugin|ms-|1.2.1 vsliveshare|ms-|1.0.470 debugger-for-chrome|msj|4.11.5 angular2-inline|nat|0.0.17 mq4|ner|1.0.4 ng-fortytwo-vscode-extension|NG-|0.0.9 mql-extension-pack|nic|0.0.4 mql-over-cpp|nic|0.0.3 mql-snippets|nic|0.1.2 angular-console|nrw|8.0.5 material-icon-theme|PKi|3.8.0 tsimporter|pmn|2.0.1 polacode|pnp|0.3.2 typescript-hero|rbb|3.0.0 LiveServer|rit|5.6.1 profitrobots-mq4-snippets|sib|1.1.0 simontest|Sim|1.4.3 autoimport|ste|1.5.3 move-ts|str|1.11.5 unique-window-colors|stu|1.0.51 Angular2|UVB|0.4.1 vscodeintellicode|Vis|1.1.7 vscode-wakatime|Wak|2.1.2 JavaScriptSnippets|xab|1.7.2 (2 theme extensions excluded)
alexr00 commented 5 years ago

Can you do manual escaping as shown in example 3 here?

vscodebot[bot] commented 5 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!