Launch a different terminal emulator from the Command line

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
GL1zdA
Junior Member
Junior Member
Posts: 15
Joined: 2005-02-07, 17:24 UTC
Location: Poland

Launch a different terminal emulator from the Command line

Post by *GL1zdA »

I often use the Command line to launch commands, and it always opens the "cmd" windows, what apparently can't be changed "system wide". But since I rarely use other means to launch cmd.exe, being able to change it just in Total Commander would make my life easier, since there exist terminal emulators that I like more than what Windows provides.

Apparently, ConEmu can hook windows to make itself "default". I don't use ConEmu, but it looks like TC could make it work the other way around: instead of being hooked, just allow to specify the terminal emulator like you do for the text editor or image viewer and launch it with the command.
User avatar
white
Power Member
Power Member
Posts: 5979
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Launch a different terminal emulator from the Command line

Post by *white »

2GL1zdA
You can set the comspec environment variable. Not sure if it's wise to do that system wide. You can also create a shortcut to set comspec and launch total commander. Example:

Code: Select all

C:\Windows\System32\cmd.exe /c set comspec="c:\windows\system32\calc.exe" & start "" "C:\totalcmd\totalcmd64.exe"
That would start the calculator instead of cmd inside Total Commander.
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Launch a different terminal emulator from the Command line

Post by *Hacker »

GL1zdA,
What white wrote, or:
TC Help wrote:Q: After the execution of a DOS command such as DIR the window is closed so quickly that the output of the program is unreadable!
A: You can start the program with SHIFT+ENTER instead of ENTER. This leaves the window open after the program terminates. The command will be started via noclose.exe in the Totalcmd directory.
replace noclose.exe as desired (with the terminal of your choice, or perhaps a symlink / hardlink to it) and run commands using Shift-Enter.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
GL1zdA
Junior Member
Junior Member
Posts: 15
Joined: 2005-02-07, 17:24 UTC
Location: Poland

Re: Launch a different terminal emulator from the Command line

Post by *GL1zdA »

white wrote: 2022-03-22, 00:10 UTC 2GL1zdA
You can set the comspec environment variable. Not sure if it's wise to do that system wide. You can also create a shortcut to set comspec and launch total commander. Example:

Code: Select all

C:\Windows\System32\cmd.exe /c set comspec="c:\windows\system32\calc.exe" & start "" "C:\totalcmd\totalcmd64.exe"
That would start the calculator instead of cmd inside Total Commander.
It didn't work as expected. It set comspec, as shown in the screenshot, but it still launches cmd:
Image: https://imgur.com/a/h9Z9xqr
Another issue is, such shortcut doesn't work with icons "pinned" to the taskbar - Windows gets confused and shows the launched Total Commander as a separate icon from the "launching" icon.
Hacker wrote: 2022-03-22, 01:12 UTC GL1zdA,
What white wrote, or:
TC Help wrote:Q: After the execution of a DOS command such as DIR the window is closed so quickly that the output of the program is unreadable!
A: You can start the program with SHIFT+ENTER instead of ENTER. This leaves the window open after the program terminates. The command will be started via noclose.exe in the Totalcmd directory.
replace noclose.exe as desired (with the terminal of your choice, or perhaps a symlink / hardlink to it) and run commands using Shift-Enter.

HTH
Roman
It didn't work, I guess because Alacritty, that I'm trying to use, has different command line options than cmd (-e instead of /C or /K).
User avatar
nsp
Power Member
Power Member
Posts: 1944
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Launch a different terminal emulator from the Command line

Post by *nsp »

Why not make a small alias like ! using user command em_Alacritty

em_Alacritty
<path to>\alacritty.exe
-e <yourshell> <noCloseOption> %A

Configure Alacrityy to have one window .....

if you want to change the shell, create a new user command and change the allias.
COMSPEC is the default shell and have noting related to the terminal as it just embed it can be std console, windows terminal, conemu, alacrity, ........
User avatar
white
Power Member
Power Member
Posts: 5979
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Launch a different terminal emulator from the Command line

Post by *white »

GL1zdA wrote: 2022-03-22, 07:11 UTC It didn't work as expected. It set comspec, as shown in the screenshot, but it still launches cmd:
Image: https://imgur.com/a/h9Z9xqr
When does it show the screenshot? After you do what? Does it work when you test it with calc?
User avatar
white
Power Member
Power Member
Posts: 5979
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Launch a different terminal emulator from the Command line

Post by *white »

nsp wrote: 2022-03-22, 08:17 UTC COMSPEC is the default shell and have noting related to the terminal as it just embed it can be std console, windows terminal, conemu, alacrity, ........
True.
GL1zdA
Junior Member
Junior Member
Posts: 15
Joined: 2005-02-07, 17:24 UTC
Location: Poland

Re: Launch a different terminal emulator from the Command line

Post by *GL1zdA »

nsp wrote: 2022-03-22, 08:17 UTC Why not make a small alias like ! using user command em_Alacritty

em_Alacritty
<path to>\alacritty.exe
-e <yourshell> <noCloseOption> %A

Configure Alacrityy to have one window .....

if you want to change the shell, create a new user command and change the allias.
COMSPEC is the default shell and have noting related to the terminal as it just embed it can be std console, windows terminal, conemu, alacrity, ........
Thanks, this works good enough for me. Defined "parameters" for the command as

Code: Select all

-e cmd /k %A --working-directory %P
, and it works fine.
white wrote: 2022-03-22, 08:56 UTC
GL1zdA wrote: 2022-03-22, 07:11 UTC It didn't work as expected. It set comspec, as shown in the screenshot, but it still launches cmd:
Image: https://imgur.com/a/h9Z9xqr
When does it show the screenshot? After you do what? Does it work when you test it with calc?
After launching TC with the shortcut you've provided and typing "cmd" and pressing "return" in the TC Command line. Same with calc - it will display calc as comspec, but will still launch cmd.
User avatar
white
Power Member
Power Member
Posts: 5979
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Launch a different terminal emulator from the Command line

Post by *white »

GL1zdA wrote: 2022-03-22, 10:58 UTC After launching TC with the shortcut you've provided and typing "cmd" and pressing "return" in the TC Command line. Same with calc - it will display calc as comspec, but will still launch cmd.
Any external program will be started as usual. Try "dir" or a batch file, or select menu option Command/Open command prompt window.
User avatar
vdijken
Member
Member
Posts: 181
Joined: 2016-07-30, 14:07 UTC
Location: The Netherlands

Re: Launch a different terminal emulator from the Command line

Post by *vdijken »

Use a button which starts the required terminal emulator. I use it for Windows Terminal to start PowerShell.
Post Reply