Sign in to follow this  
Followers 0
PeterDa

File Deletion or Move

2 posts in this topic

Hello,

I have been trying to delete a file by using the following code, I also tried moving the file specified in the commented out line below. The code does not work even if when prompted user credentials high enough to join a domain, and install software are entered.

RequireAdmin

#NoTrayIcon

Opt("WinTextMatchMode", 2) ;1=complete, 2=quick

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase

Opt("TrayAutoPause",0)

Opt("TrayIconHide", 1)

Phase1()

Func Phase1()

;IsAdmin()

;If IsAdmin() Then MsgBox(0, "", "Admin rights detected",2)

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System","ConsentPromptBehaviorAdmin","REG_DWORD", "0")

FileDelete("C:\Program Files\Microsoft Office\Office14\STARTUP\Math*.*")

FileDelete("C:\Program Files\Microsoft Office\Office14\STARTUP\*.dotm")

Sleep(2000)

;FileMove("C:\Program Files\Microsoft Office\Office14\STARTUP\Math Type Commands 6 For Word 2010.dotm", "C:\temp\Math Type Commands 6 For Word 2010.dotm")

EndFunc

Any ideas ?

Regards

Peter

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Did you check file attributes to make sure they were not Read-only? Also, you should check to see which parts error out. (See: @error in the Documentation)

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

MY PROJECTS


Active: IRC UDF, WindowEx UDF
Discontinued: GithubBubbleSort UDF

Share this post


Link to post
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
Sign in to follow this  
Followers 0