如何禁止“终止批处理作业”在cmd.exe [英] How can I suppress the "terminate batch job" in cmd.exe

查看:734
本文介绍了如何禁止“终止批处理作业”在cmd.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个机制来抑制终止批处理作业?(Y / N)邀请,当我从一个批处理文件启动的程序中按CTRL-C时,我会收到邀请:

I'm looking for a mechanism for suppressing the "Terminate batch job? (Y/N)" invitation that I get whenever I press CTRL-C in a program started from a batch file:

批处理文件:jsshell.bat:

batch file: jsshell.bat:

@echo off
java -jar build-scripts\contrib\rhino1.7R1.jar

,然后在cmd shell上通过:

and then starting it on cmd shell by:

> jsshell.bat

这给了我一个shell可以退出CTRL-C退出后给我讨厌的消息

which gives me a shell that can be exited by CTRL-C which after exiting gives me the nasty message

推荐答案

不要忘记考虑通过避免批处理脚本来解决问题。

Don't forget to consider working around the problem by avoiding batch scripts.


  • Doskey宏可以替换上面引用的一行批处理脚本。 (将它们加载到您的 Autorun 脚本。)

  • Cscript.exe 在每个现代Windows机器上都可用,并且可以从命令行运行JavaScript和VBScript程序

  • 如果您将喜爱的脚本语言(Perl,Python,Ruby等)的文件扩展名添加到PATHEXT环境变量中,并将脚本添加到路径中,则可以直接执行而不使用批处理脚本。

  • Doskey macros can replace one-liner batch scripts like the one quoted above. (Load them up in your Autorun script.)
  • Cscript.exe is available on every modern Windows machine and can run JavaScript and VBScript programs from the command line
  • If you add file extensions for your favorite scripting language (Perl, Python, Ruby, etc.) to your PATHEXT environment variable and add the script to your path, you can execute them directly without a batch script.

这篇关于如何禁止“终止批处理作业”在cmd.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆