Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...your web site's great! I've been using this system for almost a year now and find it really, really helpful. The people have been helpful in answering just about any question you post in the forums..."

Geography

Where in the world do Tek-Tips members come from?
HHaskel (Programmer)
1 Oct 09 10:36
I use this script to list all paths that are longer than 245 characters and it works as it should ecept that I get newline between length and the path.

CODE

get-childitem -r | % {if ( $_.FullName.Length -gt 245) {write-output $_.FullName.Length $_.FullName}} | tee-object -filepath c:\pathlength.txt
How can I get the length and the path on the same line?

BR
Hakan
TeflonJim (MIS)
12 Oct 09 4:21
The reason you're seeing this behaviour is that you're passing two values into Write-Output. If you want them on the same line you may find it most appropriate to use the two values within a single string:

Get-ChildItem -Recurse | %{
  if ($_.FullName.Length -gt 245) {
    write-output "$($_.FullName.Length) $($_.FullName)"
  }
} | Tee-Object -filepath c:\pathlength.txt

Your formatting options aren't limited to that, so if it's not outputting as you'd like please say.

HTH

Chris
HHaskel (Programmer)
16 Oct 09 7:25
Works perfect.

Thank you.

Best Regards
Hakan

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close