title: Running ADB commands through powershell
body: <p>so I'm trying to run some ADB commands through a powershell script. </p>
  
  <p>This is a simple example of what I am trying to do:</p>
  
  <pre><code>adb shell "
  echo "in adb shell"
  su root
  echo "you are now root."
  ls
  cd /data/data
  echo "in /data/data"
  ls
  "
  </code></pre>
  
  <p>I saw in a <a href="https://stackoverflow.com/questions/20765134/cant-run-adb-commands-in-bash-script">previous post</a> to add the "" next to shell and at the bottom but that still didn't work for me. I can start the shell and the first ls works. but it just prints the rest of the commands out instead of doing them. The output I am getting looks like:</p>
  
  <pre><code>PS C:\Scripts&gt; &amp; .\test.ps1
  : not found/sh:
  in adb shell
  su root
  echo you are now root.
  ls
  cd /data/data
  echo in /data/data
  MSM8960_lpm.rc
  acct
  cache
  .
  .
  .
  ueventd.qcom.rc 
  ueventd.rc 
  vendor PS C:\Scripts&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated. Thanks in advance!</p>
  
  <p>Note: the path to ADB is within the powershell $env:path so the adb commands are working </p>