how to get get-item cmdlet's output to variable as string

Posted by aeon on Stack Overflow See other posts from Stack Overflow or by aeon
Published on 2011-02-17T07:24:36Z Indexed on 2011/02/17 7:25 UTC
Read the original article Hit count: 230

Filed under:
|
|

i mean when i call get-item with directory it dump to console like this

    ----                -------------     ------ ----
d----         2/16/2011   8:27 PM            2011-2-16
-a---         2/13/2011   8:24 PM 3906877184 SWP-Full Database Backup_2011-02-13
                                           0
-a---         2/16/2011   8:23 PM 3919766476 SWP-Full Database Backup_2011-02-16.bak
                                           8
-a---         2/12/2011   8:18 PM 3906877747 SWP-Full Database Backup_2011-02-12
                                           2
-a---         2/14/2011   8:21 PM 3875484467 SWP-Full Database Backup_2011-02-14
                                           2

but when i convert to string it changes as

\\192.168.2.89\BwLive\2011-2-16 \\192.168.2.89\BwLive\SWP-Full Database Backup_2011-02-13 \\192.168.2.89\BwLive\SWP-Full
 Database Backup_2011-02-16.bak \\192.168.2.89\BwLive\SWP-Full Database Backup_2011-02-12 \\192.168.2.89\BwLive\SWP-Full
 Database Backup_2011-02-14

i mean length,size,time attributes is omitted how can i keep these attributes while converting to string?

thanks.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about powershell