如何继续重新启动Windows cmd提示符(How to keep restarting a Windows cmd prompt)

编程入门 行业动态 更新时间:2024-10-14 20:25:29
如何继续重新启动Windows cmd提示符(How to keep restarting a Windows cmd prompt)

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 /k

This approach only restarts cmd once. Subsequent Ctrl-C's are not caught. Is there a way to keep restarting the cmd process?

最满意答案

它必须在同一个窗口吗? 如果没有,我的运气好多了

cygstart cmd

cmd从它自己的窗口开始; 并且只有exit关闭该窗口

Does it have to be in the same window? If not, I have had much better luck with

cygstart cmd

cmd starts in its own window; and only exit closes that window

更多推荐

本文发布于:2023-08-06 21:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1455082.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:提示符   重新启动   Windows   cmd   restarting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!