Jump to content

Open txt file with elevated rights


Recommended Posts

Question...

Is it possible to open a text file with elevated rights while a script is running as a regular user for editing? :x

I'm using the "FileOpen" command in my script and just discovered that the file I'm attempting to append, the user does not have the "modify" right to. I can not change the location of the file I'm attempting to modify.

I tried this, but it is not really working...

RunAs("UserName", @ComputerName, "Password", 0, "C:\Windows\system32\notepad.exe C:\SoftwareDir\AppName\FileName.txt", "C:\Windows\system32\")
WinWaitActive("FileName.txt - Notepad")
Send("This is some added text.")
WinClose("FileName- Notepad")
WinWaitActive("Notepad", "Do you want to save")
Send("!n")

fyi...when the original script is running, I don't want the "FileName.txt" file to bee seen by the user or on the task bar.

Any ideas? :P

Link to comment
Share on other sites

  • 2 weeks later...

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