Skip to content

Instantly share code, notes, and snippets.

@xnrghzjh
Created June 20, 2011 08:03
Show Gist options
  • Save xnrghzjh/1035276 to your computer and use it in GitHub Desktop.
Save xnrghzjh/1035276 to your computer and use it in GitHub Desktop.
Excelプロセスを強制終了(wsfから移植)
/**
 Excel.exeが残ってしまった時用
*/
import org.codehaus.groovy.scriptom.*
def name = "EXCEL.EXE"
Scriptom.inApartment
{
axo = new ActiveXObject("WbemScripting.SWbemLocator");
list = axo.ConnectServer().ExecQuery("select * from Win32_Process where Name='${name}'")
list.each() { it.terminate }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment