I have a file I need to delete in "C:\prgram files\Microsoft Office\Office11\Start Up\pwd.dot". Does anyone have a script that would do this? I have tried modifying the scripts I have had posted here before, but have been unsuccsessfull. Plus I have a time limit!


0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Is there a specific language you must use? Which language are you using?
Answered 12/04/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
Try this :

Const FolderName = "Microsoft Office\Office11\StartUp"

Const DeleteEvenIfReadOnly = TRUE
Const FileToDelete = "pwd.dot"

Dim oFSO, oWSH
Dim sProgramFilesFolder

' Instantiate the various objects needed by this script
set oFSO = CreateObject("Scripting.FileSystemObject")
set oWSH = CreateObject("Wscript.Shell")

' Find the current Program Files folder - could be on C: or D: drive for example
sProgramFilesFolder = oWSH.ExpandEnvironmentStrings("%ProgramFiles%")
sProgramFilesFolder = sProgramFilesFolder & "\"

On Error Resume Next
If oFSO.FileExists(sProgramFilesFolder & FolderName & "\" & FileToDelete) then
oFSO.DeleteFile(sProgramFilesFolder & FolderName & "\" & FileToDelete), DeleteEvenIfReadOnly
end if

set oFSO = Nothing
set oWSH = Nothing


Answered 12/04/2006 by: spartacus
Fifth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity