Jump to content
Sign in to follow this  

Open txt file with elevated rights

Recommended Posts



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")

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

Share this post

Link to post
Share on other sites

Yea!!!! :idiot:

Thanks to other posts referencing "SetACL"...thanks HelgeKlein.com... my issue has been solved; albiet a work around. Bottom line, it works! ;)

Oh, and special thanks to those to posted a reply to this thread!! :)


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.