Unfortunately, you cannot escalate at run time.
To achieve the same goal, separate the code that updates your file into your own executable file, which has administrator access through its manifest.
Running this application from the main application allows you to request administrator access when it is needed , without having to unnecessarily grant permissions to the rest of your code.
source share