Page 2 of 2
Re: Create symbolic link (MKLINK /D)
Posted: 2023-09-26, 19:09 UTC
by petermad
MVV wrote: 2023-09-26, 09:58 UTC
Also these user-commands don't support Unicode names.
That can be solved by using codepage 65001:
Code: Select all
[em_junction]
cmd=*%COMSPEC% /C
param=@chcp 65001 && %%COMSPEC%% /C @for /f "usebackq tokens=*" %%i in (`type %WF`) do @( if exist "%P%%~i\" ( mklink /J "%T%%~i" "%P%%~i" ) else ( mklink "%T%%~i" "%P%%~i" ) )
menu=Make directory junction or file symlink in the opposite panel for selected files
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
Re: Create symbolic link (MKLINK /D)
Posted: 2023-11-26, 12:24 UTC
by Speeder
Here is an updated version that supports unicode, and a large amount of input files:
Code: Select all
[em_cpJunction]
cmd=*%COMSPEC% /S /C
param=? ""%%APPDATA%%\GHISLER\usercmd-cplnk.bat" "%UF" "%P" "%T" /J"
menu=Make directory junction or file symlink in the opposite panel for selected files
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpSymlink]
cmd=*%COMSPEC% /S /C
param=? ""%%APPDATA%%\GHISLER\usercmd-cplnk.bat" "%UF" "%P" "%T" /D"
menu=Make directory or file symlink in the opposite panel for selected files
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpHardJunction]
cmd=*%COMSPEC% /S /C
param=? ""%%APPDATA%%\GHISLER\usercmd-cplnk.bat" "%UF" "%P" "%T" /J /H"
menu=Make directory junction or file hardlink in the opposite panel for selected files
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpHardSymlink]
cmd=*%COMSPEC% /S /C
param=? ""%%APPDATA%%\GHISLER\usercmd-cplnk.bat" "%UF" "%P" "%T" /D /H"
menu=Make directory symlink or file hardlink in the opposite panel for selected files
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpJunctionClear]
cmd=em_cpJunction,cm_ClearAll
menu=Make directory junction or file symlink in the opposite panel for selected files, clears selection
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpSymlinkClear]
cmd=em_cpSymlink,cm_ClearAll
menu=Make directory or file symlink in the opposite panel for selected files, clears selection
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpHardJunctionClear]
cmd=em_cpHardJunction,cm_ClearAll
menu=Make directory junction or file hardlink in the opposite panel for selected files, clears selection
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
[em_cpHardSymlinkClear]
cmd=em_cpHardSymlink,cm_ClearAll
menu=Make directory symlink or file hardlink in the opposite panel for selected files, clears selection
button=%COMMANDER_PATH%\WCMICON2.DLL,65
iconic=1
Batch script to put into the "%APPDATA%\GHISLER\usercmd-cplnk.bat" path:
Code: Select all
:: CpLnk <listfile:utf8-bom> <srcdir> <tgtdir> <dirswitch> [fileswitch]
@echo off
chcp 65001 > nul
set "rmvBom=^|((pause^&pause^&pause^)^>nul^&findstr x*^)"
for /f "tokens=*" %%i in ('type "%~1" %rmvBom%') do ( if exist "%~2%%~i\" ( mklink %4 "%~3%%~i" "%~2%%~i" ) else ( mklink %5 "%~3%%~i" "%~2%%~i" ) )
Re: Create symbolic link (MKLINK /D)
Posted: 2025-01-14, 04:59 UTC
by Dr. Yukon
My way: menu
[Start] -
[Change Start Menu...]
Start menu:
-Simlink
Send folder
Get folder
Send file
Get file
--
Command for all options:
cmd
Parameters for option:
"Send folder":
/C mklink /j %T%N %P%N
"Get folder":
/C mklink /j %P%M %T%M
"Send file":
/C mklink /h %T%N %P%N
"Get file":
/C mklink /h %P%M %T%M
/d key is banned in our company