| Const WINDOW_HANDLE = 0 | | Const OPTIONS = 0 | | Dim objShell,objFolder,FolderPath,pw,wk,EAPP,FSO,FSOFolder,FSOFile | | | | Set objShell = CreateObject("Shell.Application") | | Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "Select a folder:", OPTIONS,"") | | If objFolder Is Nothing Then | | Wscript.Quit | | End If | | FolderPath =objFolder.Self.Path | | PW=Inputbox("请输入密码","批量去除密码") | | if len(PW)=0 then Wscript.Quit | | Set EAPP=CreateObject("Word.Application") | | Set FSO=CreateObject("Scripting.FileSystemObject") | | Set FSOFolder=FSO.GetFolder(FolderPath) | | For Each FSOFile in FSOFolder.Files | | If instr(Fsofile.Name,".doc") then | | Set wk=EAPP.Documents.Open(FSOFile.Path,,,,pw) | | wk.Password="" | | wk.Close True | | End If | | Next | | EAPP.QuitCOPY |
|