First:
Get-Item -Path 'C:\Windows\notepad.exe' | Select -Property Name, Length | Foreach {
#if($_.('Name').Trim() -eq "notepad.exe") {
$FileSize = $_.Length
#}
};
Wow ... directly and display as we want in KB, or MB or GB? I have not seen COM functions that provide such in-depth information. This is the limit I saw, run this:
<#The word 'Properties'/'Сво&йства'(ru) should be here, for the English version of#>
<#Windows with "&" somewere. What is shown when the right mouse button#>
<#to file/folder is pressed#>
$itemName = 'Сво&йства';
$fullPath='C:\Windows';
$o = new-object -com Shell.Application;
$folder = $o.NameSpace((Split-Path -Path $fullPath));
$file = $folder.ParseName((Split-Path -Leaf $fullPath));
$file.Verbs() | foreach ({
if($_.Name -eq $itemName){$_.DoIt()}
});
Due to the fact that Powershell has the same sources as WMIC, where data is sent in bytes, I think that the solution may be to crack some dll file, well ... or completely repeat the logic of microsoft in obtaining information of this type?
I would really like it if I was wrong. This would simplify some of my past executable code decisions.