Link to home
Start Free TrialLog in
Avatar of namerg
namergFlag for United States of America

asked on

How to add extra line into a CSV

Hello, i am trying to build a CSV with the following:
$date = Get-Date
$Out0 = "---------------VMware Health vCenter2---------------"
$Out1 = "---------------------Date and Time---------------------"
$Out2 = "--------------------" + $date + "----------------------"

Open in new window

But would like to add an space or extra line below of Out2.
Thanks for your help,
Avatar of SubSun
SubSun
Flag of India image

If you are using Add-Content to construct the CSV, then you can try something like..
$file = "C:\temp.csv"
$date = Get-Date
$Out0 = "---------------VMware Health vCenter2---------------`n---------------------Date and Time---------------------`n--------------------" + $date + "----------------------"
Add-Content $file $date                                  
Add-Content $file $Out0
Add-Content $file ""
Add-Content $file "Data Here"

Open in new window

Avatar of namerg

ASKER

Yep...
Question:
What is the difference between the `n and Add-Content $file "" ?
Avatar of namerg

ASKER

Hmm, it looks the same thing..right ?
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial