释放用完的Excel COM组件
How to Open; SaveAs; then Close an Excel 2013 (macro-enabled) workbook from PowerShell4
1. (http://www.cnblogs.com/fuhj02/archive/2010/12/23/1914313.html)
$xl.Quit()
$ws = $null
$wb = $null
$xl = $null
[GC]::Collect()
2.(http://technet.microsoft.com/en-us/library/ff730962.aspx)
$wb.Close()
$ws = $null
$wb = $null
$xl.Quit()
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($xl)
Remove-Variable xl
参考:
http://stackoverflow.com/questions/19908302/how-to-open-saveas-then-close-an-excel-2013-macro-enabled-workbook-from-powe