将焦点集中到批量应用程序 [英] Set focus to an application with batch
问题描述
我使用的是WinXP,我有一个批处理脚本,我可以确定Excel表的文件名,然后通过简单地启动Excel表来启动它。
I'm using WinXP and I have a batch script where I determine the filename of an Excel sheet and then launch it by simply launching that Excel sheet.
问题是Excel当时正在运行。所以当批处理文件启动Excel工作表时,Excel会发送到前面,并打开Excel工作表。但是,焦点仍然在批处理文件运行的DOS框中。
The problem is that Excel is running at that time. So when the batch file launches the Excel sheet, Excel is sent to front and the Excel sheet opens. However, the focus still is on the DOS-box where the batch file is running.
在这种情况下,如何将焦点设置为Excel表?
How do I set the focus to the Excel sheet in this situation?
推荐答案
尝试将文件直接传递到Excel:
Try passing the file directly to Excel:
excel.exe "C:\Path\To\file.xlsx"
我们使用开放式办公室时无法测试。
Can't test as we use open office.
编辑:
START /B (excel.exe "C:\Path\To\file.xlsx")
这篇关于将焦点集中到批量应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!