Reputation: 3065
I am using PowerShell to open a PDF file where I don't know the full filename of the PDF file.
The following questions assisted me in getting this working and the code below is from that question.
Select a file without knowing the last five characters of its name in PowerShell
$dirPath = Join-Path 'C:\temp' $currentYear
$filePath = Join-Path $dirPath 'file201520_*.pdf'
$file = Get-Item $filePath
How then can I extract its actual full name?
Upvotes: 1
Views: 232
Reputation: 37730
This will show you the properties of $File
:
$file | Format-List *
You will see that $file.Name
will tell you the file's name or $file.FullName
will give you the name with the complete path.
Upvotes: 3