user2744565
user2744565

Reputation: 243

Powershell: Create folder with today's date

I am trying to create one folder named test_20131001 like today's date.

$today = (get-date).Date  

$dateStr = '{0:yyyyMMdd}' -f $today

New-Item C:\Desktop\Access\test_$dateStr

But every time I run this script, This gives me:

type:

I don't know why this is asking type:? and I am not sure this is correct way of doing this.

Upvotes: 0

Views: 2073

Answers (1)

Jim
Jim

Reputation: 1108

The new item type parameter is missing. Try this:

New-Item C:\Desktop\Access\test_$dateStr -ItemType directory

Upvotes: 1

Related Questions