I am fairly new to Powershell scripting and I have to write a script that copies a file from a certain path and pastes it in a new folder that is created with the current date. This is what I got so far.
New-Item -Path "c:\users\random\desktop\((Get-Date).ToString('yyyy-MM-dd'))" -ItemType Directory
copy-item c:\users\random\desktop\rand.txt 'c:\users\random\desktop\((Get-Date).ToString('yyyy-MM-dd'))
When I run this script, it creates a directory called ((Get-Date).ToString('yyyy-MM-dd')) instead of today's date.
When this script runs, it has to create a directory with the current date and paste that file in it. So if I were to run it once a day for 5 days, it should create 5 different folders with the file in each of them. Any help is much appreciated.
