hi, I have this script
Function Format-FileSize() {
Param ([int]$size)
If ($size -gt 1TB) {[string]::Format("{0:0.00} TB", $size / 1TB)}
ElseIf ($size -gt 1GB) {[string]::Format("{0:0.00} GB", $size / 1GB)}
ElseIf ($size -gt 1MB) {[string]::Format("{0:0.00} MB", $size / 1MB)}
ElseIf ($size -gt 1KB) {[string]::Format("{0:0.00} kB", $size / 1KB)}
ElseIf ($size -gt 0) {[string]::Format("{0:0.00} B", $size)}
Else {""}
}
$file=$args[0]
$size=Format-FileSize((Get-Item $file).length)
Write-Host($size)
echo $size > test.txt
pause
the problem is: I like to replace “text.txt”(above the last line in program) with drive+path+name+txt extention
is there any google keyword, link, tips, function, or anything else to do this?
thank you