Cygwin的bash通常比Windows的cmd命令shell更好,因此我们在生成Windows shell之前使用它来设置我们的环境。 但是,使用Ctrl-C kill停止在此生成的shell中执行正在运行的进程会将用户引导回bash shell。
我尝试过的解决方法:
source setupEnvironment.sh restartCommand() { # Reset trap trap restartCommand SIGINT echo -e " === Restarting windows cmd prompt\n" cmd /k } trap restartCommand SIGINT echo -e " === Starting windows cmd prompt\n" cmd /k此方法仅重启cmd一次。 未捕获后续的Ctrl-C。 有没有办法继续重新启动cmd进程?
Cygwin's bash is often preferable to Windows' cmd command shell, so we use it to set up our environments before spawning a Windows shell. However, halting execution of a running process in this spawned shell with Ctrl-C kills boots the user back to the bash shell.
My attempted workaround:
source setupEnvironment.sh restartCommand() { # Reset trap trap restartCommand SIGINT echo -e " === Restarting windows cmd prompt\n" cmd /k } trap restartCommand SIGINT echo -e " === Starting windows cmd prompt\n" cmd /kThis approach only restarts cmd once. Subsequent Ctrl-C's are not caught. Is there a way to keep restarting the cmd process?
最满意答案
它必须在同一个窗口吗? 如果没有,我的运气好多了
cygstart cmdcmd从它自己的窗口开始; 并且只有exit关闭该窗口
Does it have to be in the same window? If not, I have had much better luck with
cygstart cmdcmd starts in its own window; and only exit closes that window
更多推荐
发布评论