Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Trimming path from filename

$
0
0

I've got a script I'm using to check file information in a Bin directory:

    # file path in a variable
    $bindir = "D:\PATHTO\bin"
   
    if ( Test-Path -path $bindir -IsValid){
        Get-ChildItem $bindir\*.*|
        Select-Object -ExpandProperty VersionInfo |
        Select-Object  -Property Filename, ProductVersion, ProductName
    }

 

I am getting the information I require, but I don't want the full filename including path..

 

FileName                                ProductVersion                          ProductName
--------                                --------------                          -----------
D:\PATHTO\bin\BarcodesForDoc... 3,0,4214,0                              Barcodes For Documents
D:\PATHTO\bin\BCrypt.Net.dll    0.1.0.0                                 BCrypt.Net

 

How can I trim the Filename property?


Viewing all articles
Browse latest Browse all 6937

Trending Articles