Suppose on disk D: there is a file test.txt. You can check its availability:

#устанавливаем месторасположение Set-Location "d:\" $a="test.txt" #проверка на наличие файла Test-Path $a 

But now how to read its properties. I wanted it like $, but this does not work, because it is a string, not a file object. How to get not a string, but a link to a file?

    1 answer 1

    Use cmdlet Get-Item :

     >$a="test.txt" >$fileobject = Get-Item $a >$