Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

List a specific file in Powershell and assign it to variable

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

$files = (Get-Item *.sln).name
$files
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading