I would like to achieve what I can do in a PowerShell CLI also within a Batch-Script:
PS C:\Users\andreas.luckert> $timestamp = Get-Date -UFormat "%d-%m-%Y--%R-UTC%Z" | ForEach-Object { $_ -replace ":", "." }
PS C:\Users\andreas.luckert> echo $timestamp
26-11-2021--15.55-UTC+01
Now, within my Batch-Script, I tried approaches similar to the following
SET _timestamp=('Get-Date -UFormat "%d-%m-%Y--%R-UTC%Z" | ForEach-Object { $_ -replace ":", "." }')
Yet, it does not work.
Solutions like this look a bit hacky to me, the general instructions for batch variables does not help in this case and all of these approaches are very ugly syntax-wise in comparison to the nice and clean PowerShell command I mentioned in the very beginning. Moreover, none of them include the timezone, which is important to me.