Need help with custom command (mklink)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
geo909
Junior Member
Junior Member
Posts: 2
Joined: 2019-08-28, 12:27 UTC

Need help with custom command (mklink)

Post by *geo909 »

Dear all,

New TC user here, I'm having trouble creating new command buttons, any help would be appreciated. The one that I'm currently having trouble with has to do with making junction links. If I open a cmd terminal and run "mklink testlink /J C:\myfolder", then this will create a junction link of "C:\myfolder" on the current path, named "testlink". However, if I create a button like this:

Image: https://i.imgur.com/2Nw4BAG.png

which I would assume that it creates a link of the target path onto the current one, I get instead the error:

Image: https://i.imgur.com/jX1dQ1o.png

Could somebody explain to me how to create a button that does what I want?

Thank you in advance.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Need help with custom command (mklink)

Post by *Stefan2 »

Hi and welcome geo909

Please take a right click on your button, chose COPY and paste the button code in here.


Additionally you can take a search on the forum to find f.ex:
viewtopic.php?f=28&t=51775&p=357299&hilit=mklink#p357299
and some other examples.




c u later
 
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Need help with custom command (mklink)

Post by *Usher »

2geo909
Do you use 32-bit TC in 64-bit Windows?
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Need help with custom command (mklink)

Post by *Dalai »

mklink is an internal CMD command, so there is no EXE which TC could launch. You must specify cmd.exe as application and mklink as the command to run by CMD. Example:

Code: Select all

TOTALCMD#BAR#DATA
cmd.exe
/c "mklink /J testlink %T"
C:\Windows\System32\cmd.exe
mklink


-1
To copy the button, mark the code above and paste it onto a free space on your button bar.

[EDIT] Typo [/EDIT]

Regards
Dalai
Last edited by Dalai on 2019-08-28, 19:47 UTC, edited 1 time in total.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Need help with custom command (mklink)

Post by *Horst.Epp »

From Petermad's extended Menus for TC:

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
Fore full absolute fantastic menus see:
https://www.ghisler.ch/board/viewtopic.php?t=33740
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
geo909
Junior Member
Junior Member
Posts: 2
Joined: 2019-08-28, 12:27 UTC

Re: Need help with custom command (mklink)

Post by *geo909 »

Thanks a lot guys! Dalai's suggestion works, I'll look into Horst.Epp's a bit more to understand what it does.

@usher: I'm using 64 bit windows
@Stefan2: Thanks for the suggestions, I'll have them in mind.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Need help with custom command (mklink)

Post by *Horst.Epp »

geo909 wrote: 2019-08-28, 15:59 UTC Thanks a lot guys! Dalai's suggestion works, I'll look into Horst.Epp's a bit more to understand what it does.

@usher: I'm using 64 bit windows
@Stefan2: Thanks for the suggestions, I'll have them in mind.
Add the em_commands into your usercmd.ini and you can use them in menus, buttons or assig Hotkeys to it.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: Need help with custom command (mklink)

Post by *MVV »

geo909,
1. You can't use %-parameters in Command field, only in Parameters.
2. mklink is not a separate program, it is an internal command within cmd.exe.
That's why Dalai's button is correct.

BTW, you can use my NTLinks Maker tool if you need to create links often.
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Need help with custom command (mklink)

Post by *Usher »

geo909 wrote: 2019-08-28, 15:59 UTC @usher: I'm using 64 bit windows
My question was about both TC and Windows bitness. In 64-bit Windows you should use 64-bit TC, otherwise some features (system commands, paths on disk, etc.) may be unavailable.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Need help with custom command (mklink)

Post by *petermad »

2geo909
I'll look into Horst.Epp's a bit more to understand what it does
These are external commands that are meant to be used together with my Extended Menus (see signature), but they can of course alo be used for your own buttons and shortcuts. See: http://madsenworld.dk/tcmd/symlinkmenu.png
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply