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

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

问题描述

这是 Windows 中的批处理文件.

This is a batch file in Windows.

这是我的 .bat 文件

Here is my .bat file

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

"C:ThirdParty.exe"

除了 .bat 文件在第三方"应用程序运行的整个过程中都让命令窗口保持打开状态之外,这一切正常.
我需要关闭命令窗口.

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).

第三方应用程序不允许用户更改数据库或应用程序服务器的来源.

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.

推荐答案

使用 start 对我有用:

@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 FilesVendorThirdParty.exe"

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

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