Reputation: 111
How can i use the current folder name in tasks.json using VSCODE ? related to the following variables-reference
example of file path: /home/your-username/your-project/folder/subfolder/file.ext i want to get only the subfolder name.
there is a predefined variable called ${activeFolderShort} in the following documentation for window title settings. but it's not working in tasks.json file.
here is my task code:
{
"label": "reload",
"windows": {
"command": "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"
},
"args": [
"http://localhost:52945/${activeFolderShort}/${fileBasenameNoExtension}"
],
"problemMatcher": []
}
Upvotes: 0
Views: 1031
Reputation: 28783
You can use the extension Command Variable
Use the variable
${command:extension.commandvariable.file.fileDirBasename}
Upvotes: 1