DaysSince.ps1
How old is this file?Shortcut in the archive, (assuming Win10), drop it into
C:\Users\<user>\appdata\roaming\microsoft\windows\sendto - you'll need to edit the target path to the PowerShell script if it's different from
C:\PoSh (my test folder).
Shortcut target:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -File C:\PoSh\DaysSince.ps1
<#
DaysSince.ps1 <file>
#>
Param (
$SourceFile
)
$fp = (Get-ItemProperty -Path $SourceFile)
$deltaM = (New-TimeSpan -Start $fp.LastWriteTime -End (Get-Date))
$deltaC = (New-TimeSpan -Start $fp.CreationTime -End (Get-Date))
$text = "$([io.path]::GetFileName($SourceFile))`r`nTime since:`r`nCreation:`t`t$($deltaC.Days) Days, $($deltaC.Hours) Hours, $($deltaC.Minutes) Minutes`r`n"
$text += "Modification:`t$($deltaM.Days) Days, $($deltaM.Hours) Hours, $($deltaM.Minutes) Minutes"
$wshell = New-Object -ComObject Wscript.Shell -ErrorAction Stop
$wshell.Popup($text, 0, "DaysSince", 64) | Out-Null
NOTE: I'm running PowerShell 5.x, I don't know if it will work on a lower version.
No doubt there'll be some Windows weirdness that will stop it from running, took ages to work out why it wasn't passing files with spaces in.
And no doubt you'll run afoul of PowerShell's stringent ExecutionPolicy setting, if that happens change the Shortcut Target to:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\PoSh\DaysSince.ps1