Command line alias?
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 37
- Joined: 2023-08-31, 20:08 UTC
Command line alias?
For some time I have been thinking about an alias to be able to use in command line (and in batch files called from TC command line), alias to a full path exe. The purpose is to avoid populating the path and, instead of using something along the lines of
c:\path\to\exe\someexe.exe somepar1 somepar2
to actually use
someexe somepar1 somepar2
with someexe as the defined alias. As far as I understood the documentation, I cannot create an alias to work in this way. Or I couldn't find how to. Could you give me a hint?
c:\path\to\exe\someexe.exe somepar1 somepar2
to actually use
someexe somepar1 somepar2
with someexe as the defined alias. As far as I understood the documentation, I cannot create an alias to work in this way. Or I couldn't find how to. Could you give me a hint?
#155067 Personal licence (March 2007)
Re: Command line alias?
There is many posibilities: most obvious - add program path to environment variables, note: you don't have to include ".exe" in the command so
"c:\path\to\exe\someexe.exe somepar1 somepar2" will become "someexe somepar1 somepar2" without any additional steps.
"c:\path\to\exe\someexe.exe somepar1 somepar2" will become "someexe somepar1 somepar2" without any additional steps.
-
- Junior Member
- Posts: 37
- Joined: 2023-08-31, 20:08 UTC
Re: Command line alias?
Thank you. My point is to avoid to modify the PATH environment variable.
#155067 Personal licence (March 2007)
Re: Command line alias?
Maybe one or more em_commands and then assign an alias to the em_command?
Re: Command line alias?
You can also use:
- Hard link
- Symbolic link
- Windows link (lnk file)
- BATCH file
- AHK script (or any other script)
- External launcher
- Hard link
- Symbolic link
- Windows link (lnk file)
- BATCH file
- AHK script (or any other script)
- External launcher
-
- Junior Member
- Posts: 37
- Joined: 2023-08-31, 20:08 UTC
Re: Command line alias?
Thank you. I am thinking at portable solutions. I prefer not to do it via links. Batch scripting is a solution indeed (but windows scripting is a joke compared to linux shell scripting). Will take a look at AHK as well. I thought about em_command, but were under the assumption that an em_command cannot take command line parameters and be used like that. Will look into it more carefully. Thank you indeed!
#155067 Personal licence (March 2007)
Re: Command line alias?
Assuming you want to launch it from TC: There are TC environment variables such as %commander_path% so you could use a relative path to your tool %commander_path%\..\path\to\tool.exe ?
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Re: Command line alias?
Yes, it can.Profane0360 wrote: 2025-01-31, 18:35 UTC I thought about em_command, but were under the assumption that
an em_command cannot take command line parameters and be used like that.
Re: Command line alias?
[wdx] Autorun plugin (run commands/set envvars upon TC start):
https://ghisler.ch/board/viewtopic.php?t=32427
autorun.cfg
https://ghisler.ch/board/viewtopic.php?t=32427
autorun.cfg
Code: Select all
# SetEnv <varname> <text>
SetEnv someexe c:\path\to\exe\someexe.exe
SetEnv MyAlias %commander_path%\Plugins\wlx\Imagine\Imagine.exe
SetEnv alias_123 %windir%\explorer.exe
If %AutoRun_OSArch% = 32 Then
SetEnv alias %commander_path%\TOTALCMD.EXE
Else
SetEnv alias %commander_path%\TOTALCMD64.EXE
EndIf
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Re: Command line alias?
usercmd.ini:tuska wrote: 2025-01-31, 22:01 UTCYes, it can.Profane0360 wrote: 2025-01-31, 18:35 UTC I thought about em_command, but were under the assumption that
an em_command cannot take command line parameters and be used like that.
Code: Select all
[em_someexe]
cmd=c:\path\to\exe\someexe.exe %A
Code: Select all
[Alias]
someexe=em_someexe
command line:
Code: Select all
someexe somepar1 somepar2
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
-
- Junior Member
- Posts: 37
- Joined: 2023-08-31, 20:08 UTC