${workspaceFolder} misses backslashes in task
See original GitHub issueIssue Type: Bug
In a task, when using the variable ${workspaceFolder}, the value of the variable missing the slashes.
Executing task: bash -c ‘toto=C:\Users\castelain.florianext\Documents\dummy_project && echo “$toto”’ <
C:Userscastelain.florianextDocumentsdummy_project
Terminal will be reused by tasks, press any key to close it.
Or:
Executing task: bash -c ‘echo C:\Users\castelain.florianext\Documents\dummy_project’ <
C:Userscastelain.florianextDocumentsdummy_project
Terminal will be reused by tasks, press any key to close it.
Here is the task configuration:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "bash",
"args": [
"-c",
"echo ${workspaceFolder}"
]
}
]
}
VS Code version: Code 1.68.0 (4af164ea3a06f701fe3e89a2bcbb421d2026b68f, 2022-06-08T11:44:16.822Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i5-8365U CPU @ 1.60GHz (8 x 1896) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 15.34GB (7.37GB free) |
Process Argv | –folder-uri file:///c%3A/Users/castelain.florianext/Documents/dummy_project --crash-reporter-id 3e6d7b21-c72d-454e-980b-e0a721ed60a3 |
Screen Reader | no |
VM | 0% |
Extensions (20)
Extension | Author (truncated) | Version |
---|---|---|
vscode-sql-formatter | adp | 1.4.4 |
gitlens | eam | 12.1.1 |
LogFileHighlighter | emi | 2.16.0 |
vs-code-xml-format | fab | 0.1.5 |
todo-tree | Gru | 0.0.215 |
output-colorizer | IBM | 0.1.2 |
restructuredtext | lex | 166.0.0 |
AWK | lug | 0.0.2 |
markdown-shortcuts | mdi | 0.12.0 |
git-graph | mhu | 1.30.0 |
vscode-docker | ms- | 1.17.0 |
python | ms- | 2021.9.1246542782 |
vscode-pylance | ms- | 2021.9.3 |
gradle-language | nac | 0.2.3 |
autodocstring | njp | 0.6.1 |
vscode-yaml | red | 1.8.0 |
bash-beautify | sha | 0.1.1 |
vscode-nginx | wil | 0.7.2 |
markdown-pdf | yza | 1.4.4 |
markdown-all-in-one | yzh | 3.4.3 |
(2 theme extensions excluded)
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vscaat:30438848
vsclangdf:30486550
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Forward slashes instead of back in filepath - Stack Overflow
It runs as: > Executing task: xxxxxxxx.exe --dir=${workspaceFolder//\//} , and the ${workspaceFolder//\//} is not replaced with C:/Users/User .
Read more >Variables reference - Visual Studio Code
Variables Reference. Visual Studio Code supports variable substitution in Debugging and Task configuration files as well as some select settings.
Read more >User and Workspace Settings - vscode-docs
It's easy to configure VS Code the way you want by editing the various setting files where you will find a great number...
Read more >Workflow in the Cloud Foundry Environment - SAP Help Portal
Work with Attachments on a Workflow and Task Instance. ... you can use a backslash as shown below: key1=value1,key2=value2\,value3\,value4.
Read more >Vscode set environment variables workspace
Also you should checkout vscode task dependencies. Then click Advanced System ... Nov 10, 2017 · Configuring Workspace Folder and Environment Variables.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That specific tasks is working correctly imo:
However, wrapping the the echo arg in quotes like this:
Results in no output. And using
"echo \"${workspaceFolder}\""
still ends up stripping the\
again. There may be a problem in escaping the command line?Also fwiw this task is overly complicated since it’s running bash inside cmd, you could just run bash directly which ends up working correctly:
It’s not entirely clear whether we actually do have a bug here, but regardless I think @Andromelus should move to `“type”: “process”.
The type process part above should work, having type shell means it will run inside cmd.