Page 1 of 1

Launch a different terminal emulator from the Command line

Posted: 2022-03-21, 22:39 UTC
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.

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 00:10 UTC
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.

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 01:12 UTC
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

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 07:11 UTC
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).

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 08:17 UTC
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, ........

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 08:56 UTC
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?

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 09:09 UTC
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.

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 10:58 UTC
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.

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-22, 11:11 UTC
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.

Re: Launch a different terminal emulator from the Command line

Posted: 2022-03-28, 09:46 UTC
by vdijken
Use a button which starts the required terminal emulator. I use it for Windows Terminal to start PowerShell.