Jump to content

Best way to complete the following task..


Recommended Posts

Hi Guys,

i need some assistance on the best way to do the job below with autoit.

basically I want to delete all the profiles on an XP machine but keep the Default user/ all user & logged in users profile.

what would be the best way to do this..?

Not sure if that's the best way but i guess it will work ;P Before replacing MsgBox with DirRemove THINK/TEST etc ;p i am not responsible for your losses ;p

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("C:\Documents and Settings")
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
;_ArrayDisplay($FileList,"$FileList")

For $i = 1 To $Filelist[0]
    
    If $Filelist[$i] = "All Users" OR $Filelist[$i] = "Default User" OR $Filelist[$i] = @UserName OR $Filelist[$i] = "LocalService" OR $Filelist[$i] = "NetworkService" Then
        ; Do nothing here 
    Else
        
        If MsgBox(1, "Are you sure?", "Dir for user " & $Filelist[$i] & " is about to be deleted..") = 1 Then
            
            
            ; Add deletion command here, replace MsgBox with DirRemove. SHould work
            MsgBox(0,"test","C:\Documents and Settings\" & $Filelist[$i])
            ;DirRemove("C:\Documents and Settings\" & $Filelist[$i],1)
            
        EndIf
    EndIf
Next

My little company: Evotec (PL version: Evotec)

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...