title: Giving permission to file using file attributes in TCL
body: <p>I have a client.exe Executable, that will replace itself with the file starting with "autoupdate-client.exe. 
  For example: if client.exe runs and autoupdate-client.exe is in the same folder, then the program will delete client.exe and rename autoupdate-client.exe to client.exe. The following code is implemented in widows:</p>
  
  <pre><code>if {[regexp -nocase \
  "autoupdate-(.*)" \
  [file tail [info nameofexecutable]] - binaryname]} {
  after 5000
  set dirname [file dirname [info nameofexecutabe]
  set targetname [file join $dirname $binaryname]
  catch {vfs::mk4::Unmount exe [info nameofexecutable]]
  file copy -force [infor nameofexecutable] $targetname
  catch {file attributes $targetname -permission 0755}
  exec $targetname {*}$argv &amp;
  exit 0
  } else {
  set dirname [file dirname [infor nameofexecutable]
  set targetname [file join $dirname \
  "autoupdate-[file tail [info nameofexecutablle]]}\
  ]
  if {[file exists $targetname]} {
  </code></pre>
  
  <p>after 5000
  catch {file delete -force $targetname}</p>
  
  <p>I get the following error:</p>
  
  <pre><code>error copying "autoupdate-client.exe" to "client.exe": permission denied
  while executing "
  file copy -force [info nameofexecutable] $targetname"
  </code></pre>
  
  <p>I suspect the file attribute $targetname -permission 0755 is giving an error. 
  I wanted to know how can I give permission to in windows</p>