TC 在“大小”列中显示“磁盘大小”。我可以使用外壳细节例如,但我还想要 shell 未提供的动态尺寸显示 (xx k/M/G)。
答案1
您的意思是您已设置自定义视图,并且希望在尺寸列中使用动态尺寸?我已通过将尺寸设置为[=tc.size.bkMG2]
答案2
您可以利用WinScriptAdv 插件. 这是使用 Total Commander 9.12 x64 进行测试的。
创建具有资源管理器圆角尺寸显示的自定义列。
- 下载并安装插件
- 找到插件目录并修改options.ini
- 如果 ActiveScripts 不为空,则添加到 ActiveScripts “|SizeOnDisk”,如果为空,则“ActiveScripts=SizeOnDisk”
代码:
[Script]
ActiveScripts=MinutesAgo|CheckEncoding|Signature|SizeOnDisk
; List of scripts that will work together, returning their info in columns in one panel.
; Separated by "|" - script1|script2 etc. One script can have multiple columns and display info with other
; scripts that also can be with multiple columns, all in one group of columns.
; You can add all scripts to ActiveScripts - it does not affect the performance (but takes more memory to
; load and save script code), cause script runs only if you have the corresponding visible column in TC.
[SizeOnDisk]
; File Size with explorer rounding in kB
Script=SizeOnDisk.vbs
content=sizeondisk
extensions=*
FoldersPaths=0
- 在子文件夹脚本中创建一个名为 SizeOnDisk.vbs 的文件,并将以下代码粘贴到该文件中。我不是 VBS 程序员,所以没有保证,也许有 VBS 知识的人可能会改进它
VBS 代码:
'==============================================================================
'Script for WinScriptAdv content plugin
' content - Size on Disk (Like Explorer column)
'==============================================================================
Set FSO = CreateObject("Scripting.FileSystemObject")
content = Result(filename)
Set FSO = Nothing
Function Result(pPath)
If FSO.FileExists(pPath) Then
Dim F : F = FSO.GetFile(pPath)
Dim oShell, oFSO, oEnv, oNet
Set oShell = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oEnv = oShell.Environment("Process")
Set oNet = CreateObject("WScript.Network")
Dim sTempFile, aText, i, aInfo
sTempFile = oFSO.GetAbsolutePathName(oFSO.GetTempName)
oShell.Run "%comspec% /c compact " & Chr(34) & F & Chr(34) & " > " & Chr(34) & sTempFile & Chr(34), 0, True
aText = Split(oFSO.OpenTextFile(sTempFile,1).ReadAll,vbCrLf)
If oFSO.FileExists(sTempFile) Then oFSO.DeleteFile sTempFile, True
For i = 0 To UBound(aText)
If InStr(aText(i),oFSO.GetBaseName(F)) Then
aInfo = Split(Replace(aText(i),"=",":"), ":")
If IsNumeric(Trim(aInfo(1))) Then
Result = Trim(aInfo(1))
End If
End If
Next
set F = Nothing
End If
End Function