C:\Tools\vscode_remote.ahk에 만든다. 그 내용은 아래와 같다.
#SingleInstance Force
#NoTrayIcon
; ------------------------------------------------------------
; Total Commander Parameters:
; "C:\Tools\vscode_remote_ctrlf4_min.ahk" "%P%N" "%P"
; - Arg1: "%P%N" (파일 선택 시 전체 경로, 아니면 폴더일 수도)
; - Arg2: "%P" (폴더 fallback)
; - 동작:
; · \\wsl.localhost\<Distro>\... → Code.exe --remote wsl+<Distro> "<WSL경로>"
; · /home,/mnt/... → Code.exe --remote wsl+Ubuntu "<WSL경로>"
; · 그 외(C:\..., \\server\...) → Code.exe "<경로>"
; ------------------------------------------------------------
WinCodePath := EnvGet("LOCALAPPDATA") . "\Programs\Microsoft VS Code\Code.exe"
DefaultDistro := "Ubuntu"
; ---------- 인자 ----------
arg1 := A_Args.Length >= 1 ? Trim(A_Args[1], '"') : ""
arg2 := A_Args.Length >= 2 ? Trim(A_Args[2], '"') : ""
; Arg1이 비었거나 ...\%N 로 끝나면 Arg2로 대체
badTail := RegExMatch(arg1, '[/\\]%N$', &_)
full := (arg1 = "" || badTail) ? arg2 : arg1
if (full = "")
{
dq := Chr(34)
MsgBox("인자 없음. TC 파라미터를 " . dq . "%P%N" . dq . " " . dq . "%P" . dq . " 로 설정해줘.")
Return
}
; ---------- 유틸 ----------
; UNC: \\wsl.localhost\<Distro>\sub\path → (distro, /sub/path)
IfUncWsl(path, &distro, &wslPath) {
if RegExMatch(path, '^\\\\wsl\.localhost\\([^\\]+)\\(.+)$', &m) {
distro := m[1]
p := StrReplace(m[2], '\', '/')
if (SubStr(p, 1, 1) != "/")
p := "/" . p
wslPath := p
return true
}
return false
}
; 리눅스 절대경로? (/ 로 시작, 드라이브콜론 없음)
IfLinuxAbs(path) {
return RegExMatch(path, '^/[^:\s]')
}
; Windows에서 Code 실행 (항상 재사용 창)
OpenWin(target) {
global WinCodePath
if FileExist(WinCodePath)
Run('"' . WinCodePath . '" --reuse-window "' . target . '"', "C:\")
else
Run('cmd.exe /c code --reuse-window "' . target . '"', "C:\")
}
; 로컬 Code.exe가 원격 WSL로 열기 (공백 안전: 전체를 큰따옴표로)
OpenRemote(distro, wslPath) {
global WinCodePath
cmd := '"' . WinCodePath . '" --reuse-window --remote wsl+' . distro . ' "' . wslPath . '"'
if FileExist(WinCodePath)
Run(cmd, "C:\")
else
Run('cmd.exe /c ' . cmd, "C:\")
}
; ---------- 메인 ----------
d := "", w := ""
if (IfUncWsl(full, &d, &w)) {
OpenRemote(d, w)
} else if (IfLinuxAbs(full)) {
OpenRemote(DefaultDistro, full)
} else {
OpenWin(full)
}
; 너무 빨리 끝났다고 느끼지 않게 살짝 대기 후 종료
Sleep 300
Return
토탈커맨더의 Configuration에 들어가서 Misc.를 열고 Ctrl+Shift+F4키를 등록한다.

Command: Default command (no remappng) 오른쪽 돋보기를 클릭한다.

이미 등록한 em_vscode_remote는 본인이 만든거고, New 버튼을 눌러서 새로 만들면 된다.

파일이름을 변경해주고 em_vscode_remote로 변경해주고 OK 버튼을 누른 후 아래와 똑 같이 입력해준다.

OK 버튼을 클릭 후 나와서 Hotkey: 오른쪽 화살표를 클릭하면 설정된 단축키와 사용자 정의 실행명령어가 나타난다.

이제 오픈하 파일위을 선택한 후, Shift+Ctrl+F4를 누르면 vscode가 실행되고 WSL 환경에서 원격으로 파일에 접근할 수 있게된다.
단, wsl은 Ubuntu가 default다.
ahk 스크립트의 알려진 버그는 파일에 공백이 있으면 파일이름을 제대로 건네받지 못해서 vscode -remote만 수행한다.