title: Change Windows File permissions in Lua to allow writing
body: <p>I am reading and then modifying some data in a file that is located in the Windows program files folder.
  Because of this the file does not have write permissions. So I receive an error when trying to write to it.</p>
  <p>When manually giving write permissions to the folder containing the file, the script will work.</p>
  <p>Is it possible to modify a folders permissions within a Lua script, or write to a file regardless of it's permissions? Or can this only be done manually from the File Explorer?</p>
  <p>This is my current section of code that is re-writing the inputFile:</p>
  <pre><code>k=0
  updatefile = io.open(inputFile,&quot;w&quot;)
  
  for k=1,i do     
      updatefile:write(modfilecontent[k] .. '\n')    --This is where I'm blocked by permissions
  end
  
  updatefile:close()
  </code></pre>
  <p>Also if there is a solution possible, and I load this script onto another persons computer that does not have admin privileges would the solution still work?</p>
  <hr />
  <p>EDIT:
  Piglet's solution will work using the os.execute method to change privileges.
  As long as the software, that the plug-in is being used in, is ran as admin the first time the permissions will be set. From then on you no longer need to run as admin.</p>
  <p>Below is the code that I needed to add to the beginning of the program, minus the brackets of course</p>
  <pre><code>os.execute('icacls &quot;C:\\Program Files\\[software name]\\[folder name]&quot; /grant Everyone:(OI)(CI)F /T')
  </code></pre>