the output from this script is too wide for the screen and I can't figure out how to apply .Substring() to it to suppress part of the path


i've written script find files containing given string, output wide posh truncates , i'm losing valuable portion off right-hand side.  i'm trying figure out how apply .substring() suppress base path.  here's script:

$mystring="tblperspeopleinfo"

# version gives me full path, can result in lengthy, truncated string

# string in was1reports project

$myssdtpath ="\\servername\users\christian.bahnsen\my documents\visual studio 2008\projects\was1reports\"

ls $myssdtpath-recurse | select-string $mystring | select -unique path

again, want take output on last line , apply .substring(95) (the length of path stored in $myssdtpath) to i'll remainder of path. 

thanks assistance

christian bahnsen


just use substring

ls $myssdtpath-recurse | select-string $mystring | %{$_.path.substring($myssdtpath.length)}


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client