Jef*_*ffO 53 windows executable command-line copy
这是Windows中的批处理文件.
这是我的.bat文件
@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
"C:\ThirdParty.exe"
Run Code Online (Sandbox Code Playgroud)
这工作正常,除了.bat文件在"ThirdParty"应用程序运行的整个时间内打开命令窗口.
我需要命令窗口关闭.
我会使用应用程序的快捷方式,但我必须能够首先运行此复制命令(它实际上更改了用于应用程序的数据库和服务器).
ThirdParty应用程序不允许用户更改db或应用程序服务器的源.
我们这样做是为了允许用户从测试环境更改为生产环境.
cg.*_*cg. 43
使用start
作品给我:
@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
start C:\ThirdParty.exe
Run Code Online (Sandbox Code Playgroud)
编辑:好的,仔细观察,start
似乎将第一个参数解释为引用的新窗口标题.因此,如果您需要引用ThirdParty.exe的路径,您还必须提供标题字符串.
例子:
:: Title not needed:
start C:\ThirdParty.exe
:: Title needed
start "Third Party App" "C:\Program Files\Vendor\ThirdParty.exe"
Run Code Online (Sandbox Code Playgroud)
小智 22
.vbs
使用以下代码创建文件:
CreateObject("Wscript.Shell").运行"your_batch.bat",0,True
这.vbs
将your_batch.bat
隐藏.
对我来说很好.
试试这个:
@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
start C:\ThirdParty.exe
exit
Run Code Online (Sandbox Code Playgroud)
小智 7
很棒的提示.它适用于运行java程序的批处理文件.
start javaw -classpath "%CP%" main.Main
Run Code Online (Sandbox Code Playgroud)
使用start
工作正常,除非您使用的是脚本语言.幸运的是,Python有一条出路 - 只需使用pythonw.exe
而不是python.exe
:
:: Title not needed:
start pythonw.exe application.py
Run Code Online (Sandbox Code Playgroud)
如果您需要报价,请执行以下操作:
:: Title needed
start "Great Python App" pythonw.exe "C:\Program Files\Vendor\App\application.py"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
194049 次 |
最近记录: |