title: What is the difference between Process.Start() and running manually?
body: <p>I am creating an app for the company I work for which will backup the data for some software we supply.  It has options to add SQL databases, folders, files and reg keys to the backup job which are then put into a Zip file.  There are also options to restore the backup when required.</p>
  
  <p>I am having a problem with the registry backup and restore.  I have been through many iterations of trying to get this to work but I have simplified it in a way that best illustrates my problem that I hope someone can help with.</p>
  
  <p>Essentially I am importing a ".reg" file by using the regedit.exe with command line arguments.  I have tried doing this by building it with ProcessStartInfo() but it did not work.  So to test the problem I am creating a batch file instead and running it as follows:</p>
  
  <pre><code>    File.WriteAllText("ImportReg.bat", "regedit /s /i MyRegFile.reg");
      Process.Start("ImportReg.bat");
  </code></pre>
  
  <p>This however does not work.  </p>
  
  <p>The batch file is created successfully and the REG file is valid.  Both files are in the same location as the EXE to so I don't think the issue should be with which directory is being used.  If I run the batch file myself from this location it successfully imports the registry file.  I am a full admin on the machine I am testing this on.</p>
  
  <p>I have also had issues with exporting from the registry.  Some parts of the registry export fine and others don't.  However, if I set the export up as a batch file like the import above then it works every time.</p>
  
  <p>Can anyone help with this? I cannot see why my batch file works, but not when it's run via Process.Start.  Any suggestions would be massively appreciated.</p>