I am trying to fetch a file with extension .sln file. And assign it to a variable so that I can use it it later as a variable.
PS C:\My_Agent\_work\1\s> Get-Item *.sln
Directory: C:\My_Agent\_work\1\s
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 15-06-2021 17:17 1739 project.sln
From this output I only want to fetch project.sln file and assign it to a variable in Powershell. How to achieve this.
>Solution :
$files = (Get-Item *.sln).name
$files