Friday, September 7, 2018

Create a multiple files in a folder using powershell

I want to create multiple files inside a folder. Suppose I want to name them from Benu1.csv , Benu2.CSV.. till Benu20.csv.
Also I want to put some content inside the files. Here I am writing Emailaddress as a value in the csv file.

You can create any type of file, use the file extension accordingly. Also you can increase/decrease the number of files you want.

1..20| foreach{New-Item -path c:\temp -ItemType File -Name "Benu$_.csv" -Value "EmailAddress"}