Configurable command shell
Configurable command shell
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.
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Configurable command shell
Set the ComSpec environment variable: http://en.wikipedia.org/wiki/ComSpec
Re: Configurable command shell
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.
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.
Re: Configurable command shell
So latest answer is do not use COMSPEC- but what else?
Re: Configurable command shell
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.
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.
Re: Configurable command shell
IIRC ConEmu has an option to automatically steal any console windows and put them inside ConEmu.
Ελληνικά rulez.
Re: Configurable command shell
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!
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!
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Configurable command shell
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.
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.
Re: Configurable command shell
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?
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?
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Configurable command shell
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?
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?
Re: Configurable command shell
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
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
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Configurable command shell
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?
In this light, would be my "one optional XYZ string" solution enough for your needs? If no, could you describe such usage scenario?
Re: Configurable command shell
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.
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?
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?Jan Rysavy wrote:we will execute "XYZ C:\Windows\system32\cmd.exe /K "dir""
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?
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Configurable command shell
Unfortunately it doesn't look like a small patch.
PowerShell thread: http://forum.altap.cz/viewtopic.php?f=3&t=1957
PowerShell thread: http://forum.altap.cz/viewtopic.php?f=3&t=1957
-
- ALTAP Staff
- Posts: 5231
- Joined: 08 Dec 2005, 06:34
- Location: Novy Bor, Czech Republic
- Contact:
Re: Configurable command shell
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)
-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)