通过.bat文件打开/关闭应用程序[Windows] [英] Opening/Closing application via .bat file [Windows]

查看:3102
本文介绍了通过.bat文件打开/关闭应用程序[Windows]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,我有一个.bat文件,它可以运行特定的应用程序,然后在5秒钟后将其关闭/杀死.

Good Day, I have a .bat file that run a specific application then after 5 seconds it will close/kill it.

由于它现在成功打开了应用程序,我以为当应用程序打开时,除非我手动关闭应用程序,否则它将不会执行其余命令.

I having right now due to it successfully open the application thought when the app opens it will not execute the remaining commands unless I manually close the app.

这是我的代码:

cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\"
asperascp.exe
sleep 5 
taskkill /IM asperascp.exe /f

我也尝试删除sleep命令.

cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\"
asperascp.exe
taskkill /IM asperascp.exe /f

但是它将具有相同的输出,当asperascp.exe启动时,它将不执行其余命令.

But it will have same output it will not execute the remaining commands when the asperascp.exe starts.

有什么提示吗?

谢谢.

推荐答案

您可以使用 开始/b 命令.

@echo off
cd "C:\Program Files (x86)\Aspera\Point-to-Point\bin\"
Start "" /b asperascp.exe 
timeout /T 5 /nobreak >nul
taskkill /IM asperascp.exe /F

这篇关于通过.bat文件打开/关闭应用程序[Windows]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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