title: Starting adb logs on internal storage without going into the shell
body: <p>I am trying to start internal logs within my android devices without having to go directly into the adb shell. I have to script this process so I can run it from a program. </p>
  
  <p>I am aware that you can take the following steps to start internal logs on an android device:</p>
  
  <ol>
  <li>Open a cmd prompt</li>
  <li>enter 'adb shell'</li>
  <li>enter 'logcat -v time -f /sdcard/LogFile.txt&amp;'</li>
  </ol>
  
  <p>The above will start a logcat process within the actual device. I can now unplug my phone from the computer and move around then come back and collect the logs once my test is complete. It's crucial that I am able to start this process and be able to unplug my device with the logs still running.</p>
  
  <p>To my knowledge running 'adb shell' in front of any command would run as if it were in the shell. Therefore by this logic I tried running:</p>
  
  <p><strong>Method 1:</strong></p>
  
  <p>'adb shell logcat -v time -f /sdcard/LogFile.txt&amp;'</p>
  
  <p>This command did properly start the log on the device which is great. However, once I unplug from my computer the logcat process stops. </p>
  
  <p><strong>Method 2:</strong></p>
  
  <p>'adb shell "logcat -v time -f /sdcard/LogFile.txt&amp;" ' </p>
  
  <p>This didn't seem to do anything at all on the phone and I don't know why. </p>
  
  <p><strong>Method 3</strong></p>
  
  <p>I have tried the scripting method as well where I run a Batch file that contains only:
  'adb shell &lt; Commands.txt'</p>
  
  <p>Where commands has the single line:</p>
  
  <p>'logcat -v time -f /sdcard/LogFile.txt&amp;'</p>
  
  <p>This doesn't appear to do anything. It appears to send the command once the window comes up but doesn't actually perform the action.</p>
  
  <p>Any help on this topic would be greatly appreciated. Thanks.</p>