I have a PowerShell script, but part of the output is cut out at an arbitrary point before continuing on to the next line. This is incredibly annoying.
For example, I can use Write-Host, and the line will continue as long as I want to (note that prefix information has been added to Team City and Team City, however, you can observe the same effect, output to a file):
[10:04:45] [Step 5/7] - Found Windows Service at G:\TeamCityData\TeamCityBuildAgent-1\work\282b8abc9094651e\Artefacts\windows-services\WindowsService.Dummy\WindowsService.DummyService.exe
In other cases, the output will seem artificially truncated at an arbitrary point, for example, it wraps inside a window (which is not).
So this line:
Copy-Item -Path $fullSourcePath -Destination $destPath -Recurse -Verbose -ErrorAction Stop
Produces this output in Team City (which adds some information about prefixes):
[10:04:46] [Step 5/7] VERBOSE: Performing the operation "Copy File" on target "Item:
[10:04:46] [Step 5/7] G:\TeamCityData\TeamCityBuildAgent-1\work\282b8abc9094651e\Artefacts\windows-services\WindowsService.Dummy\WindowsServi
[10:04:46] [Step 5/7] ce.DummyService.exe Destination:
[10:04:46] [Step 5/7] \\SERVER001\scheduled-tasks\ProductFolder\Dev\DummyWindowsService\WindowsService.DummyService.exe".
[10:04:46] [Step 5/7] VERBOSE: Performing the operation "Copy File" on target "Item:
[10:04:46] [Step 5/7] G:\TeamCityData\TeamCityBuildAgent-1\work\282b8abc9094651e\Artefacts\windows-services\WindowsService.Dummy\WindowsServi
[10:04:46] [Step 5/7] ce.DummyService.exe.config Destination:
[10:04:46] [Step 5/7] \\SERVER001\scheduled-tasks\ProductFolder\Dev\DummyWindowsService\WindowsService.DummyService.exe.config".
? , , .
UPDATE
, , TeamCity . , PowerShell .
:
copy-item -Path F:\logs -Destination .\ -Recurse -Verbose *> F:\logs\copy-item-output-1.txt
:
Performing the operation "Copy File" on target "Item: F:\logs\20161103-140649-ProductName.Program.log
Destination: F:\Destination\1234567890abcdefghijklmnopqrstuvwxyz\this-is-a-long-path-name-to-show-wrapping-issues-with-copy-it
em\logs\20161103-140649-ProductName.Program.log".
, , , .