1

I am using the code below to start ror server. Is there a easy way to quit that window without going through the route of finding the pid and using 'taskkill'? I mean after all i have the handle in 'shell' variable don't I?

shell = WIN32OLE.new('Shell.Application')
shell.ShellExecute("run_app_server.bat")

With the above code a window running ror server shows up. Now I also want to quit it from within the code.

Thanks

4

1 回答 1

1

好吧,你有一个对 ole 自动化Shell 对象的引用,但是一旦你使用 ShellExecute 在它自己的窗口中启动一个进程,该进程就属于 Windows,我不相信它会通过 shell 自动化对象以任何方式公开 - 所以没有办法使用对象引用来终止它。

但是,除了从 shell 中使用 Taskkill 之外,您还可以像现在一样通过自动化进行搜索和杀死——也许可以改编或“翻译”这个执行它的 Perl 脚本

于 2012-01-25T12:53:30.657 回答