AntiVirusGuy Posted May 29, 2006 Share Posted May 29, 2006 I have tried everything the path is correct, other files will delete but not this one $file1 = ("C:\Nod32OD\defs.txt") FileOpen($file1,0) $noddefs = FileReadLine($file1) FileClose($file1) FileDelete($file1) FileDelete("C:\Nod32OD\nod*.*") FileDelete("C:\Nod32OD\defs.txt") FileDelete("C:\Nod32OD\image0012.jpg") I have even tried it twice any ideas Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 29, 2006 Moderators Share Posted May 29, 2006 I have tried everything the path is correct, other files will delete but not this one$file1 = ("C:\Nod32OD\defs.txt")FileOpen($file1,0)$noddefs = FileReadLine($file1)FileClose($file1)FileDelete($file1)FileDelete("C:\Nod32OD\nod*.*")FileDelete("C:\Nod32OD\defs.txt")FileDelete("C:\Nod32OD\image0012.jpg")I have even tried it twice any ideasHave you checked to make sure that no instance of the file is still running/open? FileDelete() will not work if there is.If you say yes, what return do you get when you check the status of the FileDelete() itself? Worse case you might try FileMove() ... name it something else, and then try FileDelete(). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AntiVirusGuy Posted May 29, 2006 Author Share Posted May 29, 2006 looks like even though I have closed it autoit still keeps it locked even though I close it. once the script finishes I can delete the file. I already have this at the end of my script to selfdelete I am not sure how to ad a second file Func OnAutoItExit() ;following code causes script to delete itself Local $sCmdFile FileDelete("C:\Nod32OD\nod*.*") FileDelete("C:\Nod32OD\image0012.jpg") FileDelete(@TempDir & "\Scratch.bat") $sCmdFile = ':loop' & @CRLF & 'del "' & @ScriptFullPath & '"' & @CRLF &'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF & 'del ' & @TempDir & '\Scratch.bat' FileWrite(@TempDir & "\Scratch.bat", $sCmdFile) Run(@TempDir & "\Scratch.bat", @TempDir, @SW_HIDE) EndFunc Link to comment Share on other sites More sharing options...
Confuzzled Posted June 5, 2006 Share Posted June 5, 2006 I'm wondering why you would have to delete portions of NOD32 when it has an inbuilt uninstall facility, unless there are malicious intentions? If the anti-virus software is still running, you would have to (politely) ask it to terminate itself before deleting it, wouldn't you? Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 5, 2006 Share Posted June 5, 2006 Something I always do when trying to delete a file... Global $g_Dir $g_Dir = "C:\Nod32OD\" _RemoveFile("defs.txt") Func _RemoveFile($del_file) Local $confirm = "", $i = 0 FileChangeDir($g_Dir) $confirm = MsgBox(4, "WARNING!", "You are about to delete: " & @CRLF & $del_file & @CRLF & "Are you sure you want to continue?") If $confirm = 6 Then For $i = 0 To 10 Step 1 FileDelete($del_file) Sleep(250) If FileExists($del_file) Then ContinueLoop Else Return EndIf Next MsgBox(0, "ERROR", "File: " & $del_file & "has not been deleted. Please remove the file manually.") EndIf EndFunc See if that works... It should, if not then another part of your script is messed up. I hope it helps, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
MHz Posted June 6, 2006 Share Posted June 6, 2006 Looks like Larry is right. I'll point it out more clearly. Close the handle to FileOpen.$file1 = ("C:\Nod32OD\defs.txt")$handle = FileOpen($file1,0) ; Open handle$noddefs = FileReadLine($handle) ; Use handleFileClose($handle) ; Close handleFileDelete($file1)FileDelete("C:\Nod32OD\nod*.*")FileDelete("C:\Nod32OD\defs.txt")FileDelete("C:\Nod32OD\image0012.jpg") Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now