-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmder's Shell Terminal Integration in Nested CMD.EXE doesn't seem to work properly #2650
Comments
@nguyenduy4321 I am sorry I do not understand the issue. |
Follow me:
|
I see the issue now. Your modification to the script seems to work except there is no need for the
What is your question? |
Yeah, I mean we should update the guide for integrating You have also seen the script we just discussed that helps What do you think about this update? I believe many |
Just a friendly note: Setting up AutoRun like that will slow down every CMD invocation (even the many background ones that don't show any window), and can potentially interfere with OS or app internal invocations of CMD that aren't expecting Cmder to do so much work. The script could also potentially cause things like installing OS updates to malfunction. Something to keep it in mind in case you ever notice strange glitches in the future (or various operations being slower than normal) -- removing the script from AutoRun can be a good troubleshooting step whenever strange things are afoot on the computer. Good luck! |
@nguyenduy4321 your update makes it work but I would not advise setting autorun for the very reasons @chrisant996 raised. I honestly considered removing it from the wiki. Cmder users typically use an alternate terminal like conemu or windows terminal and leave vanilla cmd.exe alone. |
I feel sorry for cmd.exe to hear about your decision. I really like the simplicity of cmd.exe so I don't need windows terminal or conemu. @chrisant996, I posted an issue for your clink a few days ago, that post also discussed nested cmd :)). if you say clink can potentially harm the OS? |
@nguyenduy4321 It sounds like you may be missing some information.
By definition, anything that's put in AutoRun has the potential ability to harm the OS, as well as other apps. For example, did you know it's easy to accidentally send AutoRun into an infinite recursive loop that consumes all system resources by creating hundreds of new processes per second? If anything inside AutoRun launches another program, then it's likely going to do so by also silently launching a hidden cmd.exe instance ... which will run AutoRun, which triggers infinite recursion. AutoRun is inherently risky to use. Good luck! 🙃 |
Here's one example of how AutoRun can break installing an update for something (app, OS, whatever): Updates often involve running scripts. Suppose one of the scripts uses a variable name that's the same as a variable name used in a Cmder or Clink init script. Adding the extra scripts into the AutoRun regkey could interfere with the updater's script, causing it to malfunction in unpredictable ways. There are many other possible ways as well; that was just one example. Such problems are relatively unlikely to occur. Usually you will just notice things launch slower because AutoRun has extra work to do. But they definitely can occur. I've seen reports from some users where those types of interference issues are exctly what happened. I don't mean to cause alarm. But just be aware that there are tradeoffs to consider when inserting extra work into AutoRun. If something weird happens on the system, remember that one of the troubleshooting steps should be to clear the AutoRun regkey. |
I seem to be a bit stubborn. Guess I should change to Well, I just had a problem with Okay, removing |
@nguyenduy4321 If you're on Windows 11, you can set Microsoft Terminal as the default Terminal app on windows, so even if you type Then, together with the Default profile option set to Cmder, you can get the behavior you're looking for in a more modern and safe way. This is what I use BTW, which is better than using AutoRun for every instance of cmd.exe that runs. That's because The only downside with this method instead of using AutoRun is that other apps (which include an embedded terminal) won't run the clink shell, so in those apps (an IDE for example) you have to type More info: https://superuser.com/questions/678650/what-does-comspec-mean |
I followed the Terminals Integration instructions for CMD.EXE from
cmder
's wiki, including addingAutoRun
. All should be fine if just run acmd
in each window separately.We will have a problem running nested
cmds
. I understand the command@if "%cmder_init%" == "1" (goto :eof) else (set cmder_init=1)
to preventcmder
from falling into an infinite loop and so it only runs exactly once even if called many timescmd
nested in a window.Do we have a way to solve it? I have tried modifying
cmder_shell.bat
as follows:Sorry for your eyes (because of my english), check my above script, if it's ok let me know.
The text was updated successfully, but these errors were encountered: