@@ -179,7 +179,12 @@ def _stackedWriteFilePS(self, tmpPath, wFileContent, dFile, fileType):
179179 self .xpCmdshellWriteFile (psString , tmpPath , randPSScript )
180180
181181 logger .debug ("executing the PowerShell script to write the %s file" % dFile )
182- self .execCmd ("powershell -ExecutionPolicy ByPass -File \" %s\" " % randPSScriptPath )
182+
183+ commands = ("powershell -ExecutionPolicy ByPass -File \" %s\" " % randPSScriptPath ,
184+ "del /F /Q \" %s\" " % (randPSScriptPath , randPSScriptPath ))
185+ complComm = " & " .join (command for command in commands )
186+
187+ self .execCmd (complComm )
183188
184189 def _stackedWriteFileDebugExe (self , tmpPath , wFile , wFileContent , dFile , fileType ):
185190 infoMsg = "using debug.exe to write the %s " % fileType
@@ -224,7 +229,7 @@ def _stackedWriteFileDebugExe(self, tmpPath, wFile, wFileContent, dFile, fileTyp
224229 debugMsg += "%s\%s to %s file %s\%s" % (tmpPath , chunkName , fileType , tmpPath , dFileName )
225230 logger .debug (debugMsg )
226231
227- commands = ("cd \" %s\" " % tmpPath , copyCmd , "del /F %s" % chunkName )
232+ commands = ("cd \" %s\" " % tmpPath , copyCmd , "del /F /Q %s" % chunkName )
228233 complComm = " & " .join (command for command in commands )
229234
230235 self .execCmd (complComm )
0 commit comments