I am writing a powershell script. I would like to know how to create a folder with current date as name. The folder name should be "yyyy-MM-dd" (acording to the .NET custom format strings).
I know that to create folder I need to use this command:
New-Item -ItemType directory -Path "some path"
A possible solution could be (if I want to create the folder in the same directory as the script is:
$date = Get-Date
$date = $date.ToString("yyyy-MM-dd")
New-Item -ItemType directory -Path ".\$date"
Is there a way to chain the commands so I do not need to create the variable?