Need help with custom command (mklink)

English support forum

Moderators: sheep, Hacker, Stefan2, white

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 » 2019-08-28, 12:44 UTC

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: 2669
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Need help with custom command (mklink)

Post by *Stefan2 » 2019-08-28, 12:47 UTC

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:
https://ghisler.ch/board/viewtopic.php?f=28&t=51775&p=357299&hilit=mklink#p357299
and some other examples.




c u later
 
Inofficial FAQs || WIKI (Deu/Eng) || TC Home (What's new? // FAQ // Download // Order // Addons // Tools // Plugins)
Erst wenn der letzte Baum gefällt oder die letzte Biene verendet ist, werden die Leute verstehen warum Umweltschutz wichtig ist.

User avatar
Usher
Power Member
Power Member
Posts: 630
Joined: 2011-03-11, 10:11 UTC

Re: Need help with custom command (mklink)

Post by *Usher » 2019-08-28, 13:58 UTC

2geo909
Do you use 32-bit TC in 64-bit Windows?
Regards from Poland
Andrzej P. Wozniak

User avatar
Dalai
Power Member
Power Member
Posts: 6778
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Need help with custom command (mklink)

Post by *Dalai » 2019-08-28, 14:26 UTC

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

User avatar
Horst.Epp
Power Member
Power Member
Posts: 3474
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Need help with custom command (mklink)

Post by *Horst.Epp » 2019-08-28, 15:18 UTC

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:
viewtopic.php?t=33740
Windows 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.959 (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 » 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.

User avatar
Horst.Epp
Power Member
Power Member
Posts: 3474
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Need help with custom command (mklink)

Post by *Horst.Epp » 2019-08-28, 16:23 UTC

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 10 Home x64 November 2019 Update, Version 1909 (OS Build 18363.476)
Intel(R) Core(TM) i7-4770 CPU @ 3.40GH, 16GB RAM
TC 9.50ß8 x64 / x86, Everything 1.4.1.959 (x64)

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

Re: Need help with custom command (mklink)

Post by *MVV » 2019-08-28, 18:42 UTC

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: 630
Joined: 2011-03-11, 10:11 UTC

Re: Need help with custom command (mklink)

Post by *Usher » 2019-08-28, 21:53 UTC

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.
Regards from Poland
Andrzej P. Wozniak

User avatar
petermad
Power Member
Power Member
Posts: 8972
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Need help with custom command (mklink)

Post by *petermad » 2019-08-29, 02:35 UTC

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 9.5b8 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1909) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b12 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

Post Reply