运行程序并退出cmd窗口 [英] Run a Program and exit the cmd window

查看:711
本文介绍了运行程序并退出cmd窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个运行特定程序的批处理文件,然后退出命令窗口,我尝试这样做是因为我将为该批处理文件创建快捷方式,以便该批处理文件位于根目录中

I want to make a batch file that runs a particular program and then the command window exits itself, I tried this cause i will make a shortcut of that batch file so the batch file is in root directory

@echo off 
"program.exe" "mainframe.pkg"

exit

它可以工作,但是黑色窗口不会消失,并且会引起程序混乱,因为它具有周长.任何删除黑色丑陋CMD窗口的方法.

it works but the black windows doesn't disappear and causes a fuss in the program cause it has perimeters. Any way to remove the black ugly CMD window.

推荐答案

使用start命令.

@echo off
start "" "program.exe" "mainframe.pkg"

start命令后的第一个带引号的字符串是控制台窗口标题(如果正在启动控制台程序);在我的示例中,它可以是一个空字符串.然后,指定程序名称及其参数.

The first quoted string after the start command is a console window title (if you are starting a console program); it can be an empty string as in my example. After that, specify the program name and its parameters.

在脚本末尾不需要exit命令. (实际上,我建议不要使用/b参数,因为如果从cmd.exe提示符运行脚本,则cmd.exe窗口将关闭而不会发出警告.)

You do not need the exit command at the end of the script. (In fact, I recommend against it without the /b parameter, because if you run the script from a cmd.exe prompt, your cmd.exe window will close without warning.)

这篇关于运行程序并退出cmd窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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