Jump to content

getting file handle and deleting some hidden files


Recommended Posts

i have two files in my all root drives.

1- SR.exe

2- autorun.inf

both files are super hidden and read only ( +SHR ). how can i delete all of them without changing file properties for each file and delete it? another thing is i want to get the file handle of SR.exe which is also in all root drives like in

E:\

and

F:\

after getting file handle of SR.exe i want to close all its running process and after that delete the file.

i know i can try like this:

Example:

ProcessClose("SR.exe")
FileSetAttrib("E:\SR.exe", "-RSH+N")
FileDelete("E:\SR.exe")

same method for autorun.inf file will work without closing its process.

but i want some other way because i can not count drives for all pcs.

i want to work my script on all pcs. both files are hidden+System+ReadOnly

hope anyone will understand my problem and help me out.

sorry for my spelling mistakes. its due to be fast !!!

Link to comment
Share on other sites

@ d4rk

as i told before i can unhide and delete it but the same files exists in all drives. i want to unhide them all and delete them but i want to do it in all drives but i dont know how many drives may exists i other pcs. the problem is how can i unhide and delete that file in all drives. i think it would be better if you can provide a example. if still could not understand then kindly tell me which part of my post was not clear for you. thanks.

sorry for my spelling mistakes. its due to be fast !!!

Link to comment
Share on other sites

Hi, brief example with no error checking or returning..

$DelFile = "SR.exe" 

$DGD = DriveGetDrive ("Fixed")
If Not @error Then
    For $i = 1 To $DGD[0]
        If FileExists($DGD[$i] & "\" & $DelFile) Then
            If ProcessExists($DelFile) Then ProcessClose($DelFile)
            If Not ProcessExists($DelFile) Then
                FileSetAttrib($DGD[$i] & "\" & $DelFile, "-SHR+N")
                FileDelete($DGD[$i] & "\" & $DelFile)
            EndIf   
        EndIf
    Next
EndIf
BTW , the SH in the attributes doesn't mean Super Hidden.. lol

Cheers

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...