creating hard/symlinks - which way / plugin is better?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
zaffi
Junior Member
Junior Member
Posts: 34
Joined: 2009-03-24, 08:50 UTC

creating hard/symlinks - which way / plugin is better?

Post by *zaffi »

i need to create symoblic or hard links ot files;

1) I didn't find a bulit-in solution; i guess it is not yet implemented

2) i found 3 pluings that pretend to link files:

NTLinks (wdx)
ntfslinks (util)
NiftyLink (what is that?)

Currently I'm using ntfslinks, which creates hard-links, and so far it does its job.

(it have to be set up manually, and then assigned to a special shortcut-key, or menu, or button)

1) Is there another plugin or feature to craete links?
2) Is there a way to choose either soft or hard links ? (i don't know windows architecture THAT much)

thank you!
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

There are hardlinks (only for files within same volume; in fact, simply multiple folder entries for same file) and junctions (only for folders) available on all Windows NT systems, and symbolic links (for files and folders) available since Windows Vista.

NTFSLinks supports hardlinks and junctions, NTLinks allows converting folders to junctions or editing existing junctions and symlinks.

NiftyLink only creates special files (like LNK) that contain commands allowing to open programs and documents when such file is opened by NiftyLink.
User avatar
petermad
Power Member
Power Member
Posts: 16140
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2zaffi

You can find menu items for this (under "Misc.") if you download and install my extended menu - see http://www.ghisler.ch/board/viewtopic.php?t=33740
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AskParam+mklink may provide GUI dialog for asking link name, also link type may be selected from combobox...
HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Junction is another way for junctions (symlink) in Windows XP, Vista, 7 (I did not try in Win8)

Button:
> Command: Path\To\junction.exe
> Parameters: ?"%T%S1" "%P%S1"

Just locate the cursor on the source dir and press button. It asks you to create junction in other panel.
User avatar
zaffi
Junior Member
Junior Member
Posts: 34
Joined: 2009-03-24, 08:50 UTC

Post by *zaffi »

petermad wrote: You can find menu items for this (under "Misc.") if you download and install my extended menu
thank you;

(I wish it was available as a checkbox from F5... anyway)

I didn't want to install your menus,
so i copied your em_ext_*link sections
into my

Code: Select all

usercmd.ini
file,
and now I can use them from the menu / keyboard / start-menus / buttons.



for other users, here are Petermad's definitions for em_ext_junction, em_ext_symlinkd, em_ext_symlink, em_ext_hardlink


Code: Select all

[em_ext_junction]
cmd=%COMSPEC% /K
param=if exist %P%N\* (mklink /J %T%N %P%N) else (echo The cursor must be on a FOLDER)
path=%SYSTEMDRIVE%\
menu=Make Junction in Opposite Panel to FOLDER Under Cursor (Not on Network)
button=%COMMANDER_EXE%,12

[em_ext_symlinkd]
cmd=*%COMSPEC% /K
param=if exist %P%N\* (mklink /D %T%N %P%N) else (echo The cursor must be on a FOLDER)
path=%SYSTEMDRIVE%\
menu=Make Symlink in Opposite Panel to FOLDER Under Cursor
button=%COMMANDER_EXE%,12

[em_ext_symlink]
cmd=*%COMSPEC% /K
param=if not exist %P%N\* (mklink %T%N %P%N) else (echo The cursor must be on a FILE)
path=%SYSTEMDRIVE%\
menu=Make Symlink in Opposite Panel to FILE Under Cursor
button=%COMMANDER_EXE%,12

[em_ext_hardlink]
cmd=%COMSPEC% /K
param=if not exist %P%N\* (mklink /H %T%N %P%N) else (echo The cursor must be on a FILE)
path=%SYSTEMDRIVE%\
menu=MAke Hardlink in Opposite Panel to FILE Under Cursor (Only on Same Drive)
button=%COMMANDER_EXE%,12
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That's much better:

Code: Select all

Command: AskParam.exe
Parameters: /c"Create folder link" /t"%T%N" /p"Create link for %N as:" /rl /t"Junction: /J" /t"Symbolic link: /D" /p(h)"Select link type:" cmd.exe /c "if %%2==/J (title Make junction & mklink /J "%%1" "%P%N" & pause) else (start "" Sudo.exe cmd.exe /c "title Make symbolic link & mklink /D "%%1" "%P%N" & pause")"
:D

(it asks for link name, for link type, and it tries to elevate process in case of symlink; and it waits for anykey for close)
(my AskParam and Sudo are used)
Physikuss
New Member
New Member
Posts: 1
Joined: 2014-10-04, 13:00 UTC

Button with cmd /c mklink

Post by *Physikuss »

Another simple option for junctions is to create a button with the command:

Code: Select all

cmd /c mklink /j
and with the parameters:

Code: Select all

%T%N %P%N
This is very simple in Win Vista, 7 and 8 as the mklink is already present as a shell command.

This sufficient especially to create junctions for Dropbox oder GDrive synchronisation, which is the most frequent case I'm using junctions for.
mastabog
Junior Member
Junior Member
Posts: 72
Joined: 2004-03-07, 21:36 UTC

Post by *mastabog »

petermad wrote:2zaffi

You can find menu items for this (under "Misc.") if you download and install my extended menu - see http://www.ghisler.ch/board/viewtopic.php?t=33740
That's a nice (uber-geek) menu. You could improve the above by combining the "Symlink to File" and "Symlink to Folder" into a single entry called "Symlink to File/Folder Under Cursor" and to close the command window if the link is successful (otherwise keep it open if an error occurs)

Code: Select all

if exist %P%N%\* (mklink /D %T%N %P%N && exit) else (mklink %T%N %P%N && exit)
Edit: fixed command above (tested, works)

Cheers.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

mastabog,
This one will work with empty folders too:)

Code: Select all

if exist "%P%O.%E\..." (mklink
You can also try my new NTLinksMaker tool (which is a part of NTLinks package). It supports all kind of NTFS links and is able to request elevation when creating symbolic links.
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2mastabog
That's a nice (uber-geek) menu
All solutions posted in this thread are uber-geek. I still don't understand why Ghisler thinks it's too dangerous to be part of the core package.
mastabog
Junior Member
Junior Member
Posts: 72
Joined: 2004-03-07, 21:36 UTC

Post by *mastabog »

MVV wrote:mastabog,
This one will work with empty folders too:)

Code: Select all

if exist "%P%O.%E\..." (mklink
You can also try my new NTLinksMaker tool (which is a part of NTLinks package). It supports all kind of NTFS links and is able to request elevation when creating symbolic links.
Thanks. I did try NTLinks but unless I missed anything, I found it very cumbersome to work with (open file attrs panel, then click on plugin more attrs, then click and select plugin ntlinks, then click "+" to select link type, then type path ...) ... it becomes easier to open cmd and type mklink OPTS <target> <link>.

I installed Link Shell Extension which provides right click options and also file properties tab to edit the symlink/junction target.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

mastabog,
That's correct, it isn't very convenient to use attributes dialog in order to set target path, but I was talking about newNTLinks Maker tool, not NTLinks plugin itself.
Post Reply