srikanth2322
asked on
Batch file to save the unsaved opened documents
Hi,
I am running an batch file through scheduled task that shut down my pc at specified time interval, i want an batch file that saves the unsaved open documents just prior to the shutdown activity.
I am running an batch file through scheduled task that shut down my pc at specified time interval, i want an batch file that saves the unsaved open documents just prior to the shutdown activity.
That isn't possible. There is no program that can detect which files haven't been saved, nor is there a program that can tell other programs (like Word, Excel, Photoshop, or potentially a million others) to save their open files.
ASKER
if it can't recognise the unsaved documents, can the batch file save all the open documents to the specified path.
No, because no batch file can know what "unsaved documents" are. In fact, no batch file can know what documents are open at all. At best, you can get a batch file to see what programs are open, but there is no way to tell those programs to save their open files, let alone tell the programs where to save them.
ASKER
can we autosave all the documents opened through office products like word,excel,ppt.
instead of saving it manually.
instead of saving it manually.
You should be able to do that usnig VBScript. Here's a script to do it, however, this script will only save existing open files. If you are working a new file, and have never saved it before, this won't work because those files have to be "saved as".
Dim objWord, objExcel, objPPT
Set objWord = CreateObject("Word.Application")
For Each doc In objWord.Documents
doc.save
Next
Set objPPT = CreateObject("Powerpoint.Application")
For Each ppt In objPPT.Presentations
ppt.save
Next
Set objExcel = CreateObject("Excel.Application")
For Each wbook In objExcel.Workbooks
wbook.save
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
excellent