Hey friends.
$KevMar = get-childitem -path $path If ($KevMar.count = 0) {write-host "Thanks for the lesson!"}
Returns the error: .count is a read-only parameter
$gangstanthony = gci $path $gangstanthonyfixedit =$gangstanthony.count If ($gangstanthonyfixedit = 0) {write-host "Works every time."}
I get it. I’m moving from the object to a string. But I don’t understand why the $KevMar example is broken. Can someone explain what’s going on here?
*Edit- yes, clearly I had a lapse in intelligence. Thanks for the quick responses. PowerShell community is best community.
submitted by /u/unskip
[link] [comments]
The post Converting to string beats error – why dis? appeared first on How to Code .NET.