隐藏执行另一个.EXE文件的.BAT文件的命令窗口 [英] Hide Command Window of .BAT file that Executes Another .EXE File

查看:1029
本文介绍了隐藏执行另一个.EXE文件的.BAT文件的命令窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是Windows中的批处理文件。

This is a batch file in Windows.

这是我的.bat文件

@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"

"C:\ThirdParty.exe"

除了.bat文件保留命令窗口打开ThirdParty应用程序正在运行。

我需要关闭命令窗口。

This works fine except the .bat file leaves the command window open the whole time the "ThirdParty" application is running.
I need the command window to close.

我将使用应用程序的快捷方式,但我必须能够首先运行此复制命令(它实际上会更改应用程序使用的数据库和服务器)。

I would use the short-cut for the application but I must be able to run this copy command first (it actually changes which data base and server to use for the application).

ThirdParty应用程序不允许用户更改数据库或应用程序服务器的源。

The ThirdParty application does not allow the user to change the source of the db or the application server.

我们这样做是为了允许用户从测试环境切换到生产环境。

We're doing this to allow users to change from a test environment to the production environment.

推荐答案

使用开始为我工作:

@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
start C:\ThirdParty.exe

编辑:好的,更仔细地看, start 似乎将第一个参数解释为新窗口标题(如果有引号)。所以,如果你需要引用你的ThirdParty.exe的路径,你必须提供一个标题字符串。

Ok, looking more closely, start seems to interpret the first parameter as the new window title if quoted. So, if you need to quote the path to your ThirdParty.exe you must supply a title string as well.

示例:

:: Title not needed:
start C:\ThirdParty.exe

:: Title needed
start "Third Party App" "C:\Program Files\Vendor\ThirdParty.exe"

这篇关于隐藏执行另一个.EXE文件的.BAT文件的命令窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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