I'm running small shell commands via tasks in VS code.
Within these commands I need the current timestamp.
Given I'm trying to run something like mkdir ./%date
in a task:
{
"label": "make timestamp dir",
"type": "shell",
"command": "mkdir ${workspaceFolder}/%date%",
},
I tried using %date%
and %time%
but both is not substituted.
Alternatively I did see that VS code allows to call commands with ${command:CommandID}
.
Therefore I installed a extension that generates a timestamp: https://marketplace.visualstudio.com/items?itemName=jsynowiec.vscode-insertdatestring
I tried to use that with ${command:insertDateString.insertTimestamp}
:
{
"label": "make timestamp dir",
"type": "shell",
"command": "mkdir ${workspaceFolder}/${command:insertDateString.insertTimestamp}",
},
But that also is not substituted.
I'm out of ideas. How to add a timestamp in a VS code task?