运行批处理文件后如何关闭命令行窗口? [英] How to close the command line window after running a batch file?

查看:541
本文介绍了运行批处理文件后如何关闭命令行窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个批处理文件.完成运行后,即所有命令行均已执行, cmd.exe 窗口保持打开状态.但是,我想在批处理文件完成工作后立即关闭它.

I've got a batch file. After it finished running, i.e. all command lines have been executed, the cmd.exe window stays open. However, I'd like to have it closed right after the batch file finishes its job.

到目前为止,我已经尝试在批处理文件中使用exit命令关闭cmd窗口(我在桌面上也有一个快捷方式),但是它似乎不起作用:

So far I've tried using the exit command within the batch file to close the cmd window (I also have a shortcut on the desktop) but it doesn't seem to work:

tncserver.exe C:\Work -p4 -b57600 -r -cFE -tTNC426B
exit

推荐答案

它应该自动关闭,如果没有关闭,则意味着它卡在了第一个命令上.

It should close automatically, if it doesn't it means that it is stuck on the first command.

在您的示例中,它应该自动关闭(没有exit)或显式关闭exit.我认为问题出在您正在运行的第一个命令未正确返回.

In your example it should close either automatically (without the exit) or explicitly with the exit. I think the issue is with the first command you are running not returning properly.

作为解决方法,您可以尝试使用

As a work around you can try using

start "" tncserver.exe C:\Work -p4 -b57600 -r -cFE -tTNC426B

这篇关于运行批处理文件后如何关闭命令行窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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