I have a small script that searches through all files in a directory using something like this;
Get-Ch开发者_Python百科ildItem $location -recurse | select-string -pattern $pattern | select-object Path, FileName, LineNumber > C:\test.txt
The problem I have is that the Path gets enshortened, like this;
C:\program files\new folder\new f...
How can I get it to display the full path?
Just so it's clear why you saw the truncating behavior, the default formatter picked is Format-Table which divies up the current host width into three equally sized columns and if the data is wider than that it gets truncated.  Another way of doing this:
gci $location -r | select-string $pattern | 
  Format-Table Path, FileName, LineNumber -Auto | 
  Out-File C:\test.txt -width 512
Export-Csv
made it possible, thanks to BartekB and denty on freenode's #powershell
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论