I know that I can use:
gc c:\\FileWithEmptyLines.txt | where {$_ -ne \"\"} > c:\\FileWithNoEmptyLines.txt
to remove empty lines. But How
You can use -match instead -eq if you also want to exclude files that only contain whitespace characters:
@(gc c:\FileWithEmptyLines.txt) -match '\S' | out-file c:\FileWithNoEmptyLines