title: Can I run an adb shell command in C# and not have it interrupted when I unplug the USB cable?
body: <p>I'm running adb shell commands using the method described below</p>
  
  <pre><code>System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/c " + cmd);
  procStartInfo.RedirectStandardInput = true;
  procStartInfo.RedirectStandardOutput = true;
  procStartInfo.RedirectStandardError = true;
  procStartInfo.UseShellExecute = false;
  procStartInfo.CreateNoWindow = true;
  
  System.Diagnostics.Process proc = new System.Diagnostics.Process();
  proc.StartInfo = procStartInfo;
  proc.Start();
  </code></pre>
  
  <p>On the android phone I'm starting an app that records a video so cmd = "adb shell am startservice -n com.xxx.xxx/.xxx".</p>
  
  <p>The problem is that I need to unplug the USB cable after I start recording video. If I do that, the resulting video file won't play.  Sometimes it's 0KB. If I leave the USB cable connected, then the video is fine.</p>
  
  <p>Is there a way to perform the adb command so that the video will continue recording after I unplug the USB cable?  Everything is fine when I enter the command from the command prompt and unplug the USB cable.</p>