Jump to content

File Deletion or Move


PeterDa
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

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