Skip to main content

Export-CSV Powershell, don't include pesky first line

You use Export-CSV to export a result to CSV in powershell, 

It's a great tool, but it also includes type information in the first line. 

For a GCI command, it typically creates something like; 

#TYPE System.IO.DirectoryInfo

This breaks a single click open when you want to view the file in something like Excel.

You can tell Export-CSV to stop creating the Type Info by using the switch;

    -NoTypeInformation


So, your command ends up something like 

    gci -recurse | export-csv "20221124.csv" -NoTypeInformation


Comments

Popular posts from this blog

Javascript Form Validation

It's real simple. All you need to do is call a javascript function in a html  " onsubmit " in the form tag as a javascript return, like this       <form method="post" action="dosomething.php" onsubmit="return validateForm();"> If the code completes ok, the form is then sent to the page listed in "action" http://www.w3schools.com/js/js_form_validation.asp If the function specified in the onsubmit returns false, then the form is not sent to the page mentioned in action.