Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining files using COPY command and getting odd characters

I have a bunch of small PowerShell functions, each in their own file and I am trying to combine them into a larger file.

Using the low-tech approach of the Windows copy command by doing: copy /Y /A functions\*.ps1 super.ps1 works fine however where two files are joined it is inserting: 

I'm guessing it's the line break characters showing up (difference of encoding), but how do I prevent these characters from showing up?

like image 432
Robert MacLean Avatar asked Aug 19 '09 09:08

Robert MacLean


2 Answers

How you tried /B for binary to stop OEM characterset translation

Who knows

Or open your scripts in notepad and save them as ANSI then try and join them with your normal copy command no /B required

like image 82
kingchris Avatar answered Sep 21 '22 19:09

kingchris


Those characters are unicode byte order marks which will be invisibly preceding the .ps1 content.

I'm not sure how you'd strip them off in plain DOS -- at this point I'd turn to a scripting language to do the work. You could write a PowerShell script to join them using the .net System.IO features.

like image 33
Steve Gilham Avatar answered Sep 19 '22 19:09

Steve Gilham