PDA

View Full Version : how to close an excel file from command line?



jeff06
07-30-2007, 10:54 AM
I can open an excel using command line
"excel.exe" /x "c:\temp\book3.xls"

How can I close book3.xls from commandline?

Thanks

JKwan
07-30-2007, 11:22 AM
If you are using XP, you can use the TASKKILL command to do the job. You can get a command list by entering TASKKILL /?. As an example:

TASKKILL /FI "WINDOWTITLE eq Microsoft Excel - Book3.xls"

Enter the above line as is, that will terminate Excel with Book3.xls loaded. Hope this helps.

PS - Those quotes, they are part of the command, so make sure you put them in as is - or copy the line.

jeff06
07-30-2007, 12:05 PM
Thanks