Answer the question
In order to leave comments, you need to log in
What is the correct way to set a variable to the size of the largest file in a directory?
Help me figure out the correct spelling of the syntax
I'm trying like this, but the variable is empty
Set-Location C:\Users\
$status = get-childitem -Recurse | Sort-Object -Descending -Property length | Select -First 1 length
Answer the question
In order to leave comments, you need to log in
well, it’s hardly empty, if only the directory is empty,
most likely there is an object with one property - Length
if you need only a number, then like this
get-childitem -Recurse | Sort-Object -Descending -Property length | Select -First 1 -ExpandProperty Length
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question