title: RESTORE .bak-file from c:\users\ directories on SQL Server
body: <p>I have this update tool for my program. The tool updates the SQL Server database with this code (vb and sql).</p>
  
  <pre><code>Dim sql As Process = Process.Start("sqlcmd.exe", Param + " -i update.sql -o log.txt")
  </code></pre>
  
  <p><code>Param</code> contains the name of the <code>.bak</code> file <code>myprogram_update.bak</code> among others.</p>
  
  <p><code>update.sql</code> starts with</p>
  
  <pre><code>RESTORE DATABASE [myprogram_tmp] 
  FROM DISK = N'$(db_src)' 
  WITH FILE = 1,  
  MOVE N'myprogram_tmp' TO @mdf,
  MOVE N'myprogram_tmp_log' TO @ldf,
  NOUNLOAD, STATS = 5
  </code></pre>
  
  <p><code>@mdf</code> and <code>@ldf</code> are standard paths read from the SQL Server settings.</p>
  
  <p>The update tool is shipped to customers and the problem is that usually SQL Servers aren't allowed to read in user directories of windows like <code>Desktop</code> or <code>Downloads</code>. But many customers unzip the archive to these directories and then they get this error.</p>
  
  <blockquote>
    <p>Could not access myprogram_update.bak / access denied.</p>
  </blockquote>
  
  <p>I can't change the settings on every customers server, so is there any way to make it work for these directories? One idea of mine was to run a setup first and unzip it to <code>program files</code> but maybe there is a smarter solution.</p>
  
  <p>Edit: the tool runs in administrator mode.</p>