Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9217

How to fix truncated PowerShell output, even when I've specified -width 300

$
0
0

I'm trying to get a list of all the directories and files on an external hard drive, with one fully-qualified directory/file path per line. I'm using PowerShell on Windows 10 to achieve this. This is the PowerShell command I'm using:

Get-ChildItem 'E:\' -Force -Recurse | Select-Object FullName | Out-File -Encoding utf8 "C:\Users\Me\Desktop\listing.txt" -width 300

However, some paths are being truncated in my output. In fact, over 10,000 lines are truncated. Here is an example of one line in my listing.txt PowerShell output file:

E:\Sort\Tech Stuff\2006-2007 CompanyLtd\fsie01-Engineering-Users-User1\Reference\LCID & Language Group by Language\Configuring and Using International Features of Windows Windows 2000 - List of Locale I...

When I browse to this directory in File Explorer (E:\Sort\Tech Stuff\2006-2007 CompanyLtd\fsie01-Engineering-Users-User1\Reference\LCID & Language Group by Language), the file there is called 'Configuring and Using International Features of Windows Windows 2000 - List of Locale IDs and Language Groups.url'. The path of this file is 228 characters long if I haven't miscounted, which should be within acceptable limits.

What am I doing wrong that is truncating the paths in my PowerShell output?


Viewing all articles
Browse latest Browse all 9217

Trending Articles