Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 481
  • Last Modified:

Possible Method (Script?) to Save Open Files in Word, Close Word, then Re-Open Word With Last Document Open?

Good Morning All -

This weekend, I must deploy a new file (overwriting an old one) to all workstations.  The file is referenced by Microsoft Word 2010 therefore Word must be closed for the file to successfully copy.  Also, I'm using SCCM 2012 to accomplish this.

I created a task sequence which does the following:
- Force Word to quit ("tskill winword /a")
- Copies file (xcopy string)

It works great and I am deploying it early in the morning - however - we have some people who work at all hours.  Ideally, I'm trying to find the best method to where there is no interruption as I know people leave Word docs open overnight, too.

Therefore, what I'm trying to find is a method or script which would do the following:
1. Save any open documents in Word if there are any open
2. Exit or taskkill Word
3. Pause to let me copy the file /w xcopy
4. Re-Open Word with the last document that was open - IF - Word was previously open when script began

I know that this is a lot to ask and maybe not possible without hours of coding.  Still, why not ask.

1 Solution
Michael DyerSenior Systems Support AnalystCommented:
There is no way to send a command from the command line to the MS Word UI, so you cannot force it to save and shut down.  You may have to simple resort to sending out an email or message that Word is shutting down in five minutes, please save your work.  If you enable the Messenger Service on all of your computers, you can send a net message.  

Here is info on how to do that:  http://support.microsoft.com/kb/168893

You could maybe write a batch file that sends a warning message to all computers, wait for five minutes, then taskkill Word and copy in the files.  I ususally use the ping command to pause a batch file - this will pause for about five minutes.

PING -n 301

Good Luck!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now