Skip to content

Use wsl terminal with Total Commander

Gore Liu edited this page Sep 18, 2017 · 8 revisions

Open wsl-terminal in Total Commander

Add this to usercmd.ini:

[em_open_wsl]
cmd=c:\path\to\wsl-terminal\open-wsl

And bind a shortcut in wincmd.ini:

[Shortcuts]
; <key> is
; a (a)
; S+s (shift + s)
; C+o (Ctrl + o)
; f2 (F2)
<key>=em_open_wsl

Open files in vim

Open Configuration dialog, Operation -> Edit/View, select vim.exe as Viewer(F3) or Editor(F4).

Run commands on selected files in wsl-terminal

Run md5sum command on selected files and show results in wsl-terminal when I press shift + s, add this to usercmd.ini:

[em_md5sum]
cmd=c:\path\to\wsl-terminal\bin\mintty
param=-t 'md5sum %S' -e /bin/wslbridge -t bash -c 'md5sum %S; read -n1 -r'

And bind em_md5sum to S+s in wincmd.ini -> [Shortcuts].

Run commands on the current file and show results in lister

Run ffprobe on video files, and see result in lister:

Install AnyCmd plugin: http://totalcmd.net/plugring/anycmd.html

Write a look.sh in wlx/anycmd:

filename="$(echo /mnt/$@ | tr '\\' '/'|tr -d ':')"

# Use iconv in a Chinese version of windows.
ffprobe -hide_banner "$filename" 2>&1 \
    | fold -w 58 -s \
    | iconv -f utf-8 -t gbk -c

Edit anycmd.ini:

[AnyCmd]
DetectString=TRUE
; 32 bit TC 
command=c:\windows\sysnative\bash /mnt/c/totalcmd/plugins/wlx/anycmd/look.sh "%s"
; 64 bit TC
command=c:\windows\system32\bash /mnt/c/totalcmd/plugins/wlx/anycmd/look.sh "%s"

; TC path need to be changed.
; Note %COMMANDER_PATH%\plugins\wlx\anycmd\look.sh is not work.

Stream=3