Configurable command shell

We welcome any suggestions for new features or improvements in Altap Salamander. Please post one suggestion per report.
dabide
Posts: 1
Joined: 25 Jun 2012, 15:32

Configurable command shell

Post by dabide » 25 Jun 2012, 15:38

Salamander uses CMD when running commands with Ctrl-Enter, or when launching a command shell. It would be very nice if this could be made configurable, so that we could use for instance Console 2 or ConEmu.

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5127
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Configurable command shell

Post by Jan Rysavy » 26 Jun 2012, 14:40

Set the ComSpec environment variable: http://en.wikipedia.org/wiki/ComSpec

User avatar
Ether
Posts: 1459
Joined: 10 May 2007, 16:08
Location: Czech Republic
Contact:

Re: Configurable command shell

Post by Ether » 26 Jun 2012, 15:44

Setting COMSPEC environment variable can lead to various problems with your system, as some applications (and possibly even parts of Windows) are depending on COMSPEC to contain the path to the cmd.exe shell or at least a compatible one (regarding accepted switches). I recommend reading the following discussions:

A discussion about a problem with Komodo software, topics related to COMSPEC here, on Salamander Forums, especially this one that uses AutoHotKey to launch Console2 from Salamander.
Ελληνικά rulez.

treb
Posts: 11
Joined: 21 Oct 2015, 10:14

Re: Configurable command shell

Post by treb » 27 Oct 2015, 10:35

So latest answer is do not use COMSPEC- but what else?

User avatar
SvA
Posts: 441
Joined: 29 Mar 2006, 02:41
Location: DE

Re: Configurable command shell

Post by SvA » 28 Oct 2015, 18:47

Well, I think you are drawing the wrong conclusion. You should use COMSPEC to point to any command shell you like. That shell should be compatible to cmd.exe, though.

But what about setting up cmd.exe to automatically lauch the shell wrapper of your liking, if that is not compatible? There is a registry entry you can set to a command or script that is launched at start. Also there is %CMDCMDLINE% so you can get at the parameters passed to cmd.exe.

I did not delve into what problems people had with setting COMSPEC, but I really don't see what should break when used with a compatible replacement. Any shell that is not compatible is obviously ment to not be a replacement, such as for example powershell.

User avatar
Ether
Posts: 1459
Joined: 10 May 2007, 16:08
Location: Czech Republic
Contact:

Re: Configurable command shell

Post by Ether » 11 Nov 2015, 13:40

IIRC ConEmu has an option to automatically steal any console windows and put them inside ConEmu.
Ελληνικά rulez.

treb
Posts: 11
Joined: 21 Oct 2015, 10:14

Re: Configurable command shell

Post by treb » 03 Dec 2015, 15:12

Hello,
I also would like to have such setting inside Altap Salamander and make settings easier than any other option pointed above.
I really think that addition is easier to provide compared to the benefit we will have...



Regards!

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5127
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Configurable command shell

Post by Jan Rysavy » 03 Dec 2015, 22:39

We don't use Console 2 nor ConEmu, so I will ask basic questions.
Do you expect we will call "ConEmu.exe /cmd cmd /k ..." instead of current "cmd /k ..."?
ConEmu.exe would be path from AS configuration, default clear/unused.

treb
Posts: 11
Joined: 21 Oct 2015, 10:14

Re: Configurable command shell

Post by treb » 04 Dec 2015, 07:57

Hello,
First thanks for answering.
Second - I really expect that idea is to be able to call any terminal with passing just file and path like :
"ConEmu.exe" /cmd \"%1\" %*"

I do't understand your last question/sentence can you clarify?

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5127
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Configurable command shell

Post by Jan Rysavy » 04 Dec 2015, 09:43

What is Salamander doing now when invoking CMD:
1. get environment variable COMSPEC
2. attach /C or /K according to http://www.altap.cz/salamander/help/sal ... k_cmdline/ (Close shell window after command execution)
3. attach command line content
4. execute it through CreateProcess API, for example: "C:\Windows\system32\cmd.exe /K "dir""

I assume there should be some new option in AS configuration to start this command using another application. Will be plain text edit line enough? Just one string we will insert to CreateProcess() command?

Instead of "C:\Windows\system32\cmd.exe /K "dir""
we will execute "XYZ C:\Windows\system32\cmd.exe /K "dir""
where XYZ will be such string from configuration? You will be able to put "ConEmu.exe /cmd" there.

Is it all you need? Just one global variable in AS configuration with string XYZ?

treb
Posts: 11
Joined: 21 Oct 2015, 10:14

Re: Configurable command shell

Post by treb » 04 Dec 2015, 10:10

Hello Jan,
thanks for answering!
Yes even such an option will be very useful and option for better configuration.

I was hoping also for a more separated approach:
1. Field (string ) for Environment variable - "COMSPEC" by default
2. Field for options 1 - /C by default
3. Field for options 2 - /K by default
4. Field for option 3 - %DIR - placeholder for starting dir



But of course this is just an idea

Regards

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5127
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Configurable command shell

Post by Jan Rysavy » 04 Dec 2015, 10:24

It looks like feature for very small part of Altap Salamander users so we would like to keep it as small as possible (space in configuration dialog box, space in Windows Registry, description in AS help, size in AS code base).

In this light, would be my "one optional XYZ string" solution enough for your needs? If no, could you describe such usage scenario?

User avatar
SvA
Posts: 441
Joined: 29 Mar 2006, 02:41
Location: DE

Re: Configurable command shell

Post by SvA » 04 Dec 2015, 17:01

What about using user menu entries (or using the same interface to configure entries)? Thus you have a flexible framework integrated already. You just need an interface to assign these entries to the different places where the shell is called (Command Line toolbar with or without a command; from a file panel, from the user menu with and without the close option, and maybe more. Different approaches to this could be taken.
Jan Rysavy wrote:we will execute "XYZ C:\Windows\system32\cmd.exe /K "dir""
What if i can't cope with the C:\Windows\system32\cmd.exe part? What if my shell needs something different from /C and /K? What if the shell needs some other way to set the working directory?

I believe, two text boxes with variable substitution is the bare minimum to support this in a useful way other than referring people to COMSPEC.

Take for example PowerShell, an command shell that is completely incompatible to cmd when it comes to launchig it. But Powershell has been requested in the past as a replacement for command line consoles from Salamander. What does it take to configure it in AS?

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5127
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Configurable command shell

Post by Jan Rysavy » 04 Dec 2015, 17:15

Unfortunately it doesn't look like a small patch.

PowerShell thread: http://forum.altap.cz/viewtopic.php?f=3&t=1957

Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5127
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Configurable command shell

Post by Jan Rysavy » 04 Dec 2015, 17:30

Note: Salamander is calling %COMSPEC% from:
-Command Line (with /C or /K parameter, command from edit line)
-Command Shell command (Num /)
-User Menu (with /C or /K parameter, command from User Menu item)
-Renamer dialog box, Filter List Through Shell Command (with /C parameter, command from edit line)

Post Reply