mdwerne Posted June 2, 2009 Share Posted June 2, 2009 Can anyone see why this might not work? I get the message "The file was not deleted" so I believe it's finding the file. This is on a Vista machine, but the script will eventually run under Vista or XP. Dim $SettingsLiveUpdate = "C:\Documents And Settings\All Users\Application Data\Symantec\LiveUpdate\Settings.LiveUpdate" If FileExists($SettingsLiveUpdate) Then FileDelete($SettingsLiveUpdate) If FileExists($SettingsLiveUpdate) Then MsgBox(0, "Not Deleted", "The file was not deleted.") Else MsgBox(0, "Deleted", "The file was deleted.") EndIf Else MsgBox(0, "Please locate", "Please locate and delete the file 'Settings.LiveUpdate'.") EndIf Thanks for any suggestions, -Mike Link to comment Share on other sites More sharing options...
Inverted Posted June 2, 2009 Share Posted June 2, 2009 (edited) Try with #RequireAdmin on top of the script. Maybe Vista doesn't allow the operation (UAC?) Edited June 2, 2009 by Inverted Link to comment Share on other sites More sharing options...
mdwerne Posted June 2, 2009 Author Share Posted June 2, 2009 (edited) Try with #RequireAdminon top of the script. Maybe Vista doesn't allow the operation (UAC?)Nope...didn't help.I keep looking at my assignment of $SettingsLiveUpdate and keep thinking I am assigning the whole path into the variable, not just the file name.And UAC is disabled. Edited June 2, 2009 by mdwerne Link to comment Share on other sites More sharing options...
Inverted Posted June 2, 2009 Share Posted June 2, 2009 (edited) The help file says : "Some file attributes can make the deletion impossible." What are the file's attributes ? Also, try FileRecycle, just for giggles Edited June 2, 2009 by Inverted Link to comment Share on other sites More sharing options...
mdwerne Posted June 2, 2009 Author Share Posted June 2, 2009 The help file says : "Some file attributes can make the deletion impossible." What are the file's attributes ? Also, try FileRecycle, just for giggles Cupie doll to Inverted! There were three issues: 1) The "real" vista path was different, variable was going through a shortcut. I added more code. 2) You were right, file was read only. I thought because I could delete it by hand that it wasn't. Dumb on my part. 3) Because it was read only, filedelete did not work, but FileRecycle DID!! Here is the final: #RequireAdmin If @OSVersion = "WIN_XP" Then $SettingsLiveUpdate = "C:\Documents And Settings\All Users\Application Data\Symantec\LiveUpdate\Settings.LiveUpdate" ElseIf @OSVersion = "WIN_Vista" Then $SettingsLiveUpdate = "C:\ProgramData\Symantec\LiveUpdate\Settings.LiveUpdate" Else MsgBox(0, "Error", "Unsupported OS") Exit EndIf If FileExists($SettingsLiveUpdate) Then FileRecycle($SettingsLiveUpdate) If FileExists($SettingsLiveUpdate) Then MsgBox(0, "Not Deleted", "The file was not deleted.") Else MsgBox(0, "Deleted", "The file was deleted.") EndIf Else MsgBox(0, "Please locate", "Please locate and delete the file 'Settings.LiveUpdate'.") EndIf Thanks for the tips!!! My bad for not reading the helpfile more closely. :-( -Mike Link to comment Share on other sites More sharing options...
Inverted Posted June 2, 2009 Share Posted June 2, 2009 (edited) It gets even better, you can use directory macros (check help file!) So, it will work everywhere without hardcoded full paths :-) @AppDataCommonDir should be the one for "All Users" EDIT: There are other OSes beside XP and Vista, your OS check is brutal ! Edited June 2, 2009 by Inverted Link to comment Share on other sites More sharing options...
ProgAndy Posted June 2, 2009 Share Posted June 2, 2009 EDIT: There are other OSes beside XP and Vista, your OS check is brutal ! Not only OSes. Also there are other languages. (eg German ) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Inverted Posted June 2, 2009 Share Posted June 2, 2009 You're right ProgAndy, also windows can be installed on other drives, other than C: 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