gpt4 book ai didi

java - 使用java代码退出批处理文件

转载 作者:行者123 更新时间:2023-11-30 05:17:23 25 4
gpt4 key购买 nike

我有这样的示例代码。

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author padmaja
*/

import java.io.*;
class Test{
public static void main(String arg[]){
try{
String command = "cmd /C start C:/excel.bat";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
}catch (IOException e) {
e.printStackTrace();
}
}
}

我正在使用上面的代码打开 Excel 工作表。

问题是,如果使用线程每 15 分钟打开一次 Excel 工作表,则会显示多个 Excel 工作表。我想从上面的代码本身关闭批处理文件的运行。

提前致谢

最佳答案

打开 Excel 工作表后,最终用户将与其进行交互,对吧?您如何知道可以关闭它?如果您仅为某些在加载时运行的宏启动 Excel,则您可以在该宏本身中退出。

关于java - 使用java代码退出批处理文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/434581/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com