title: How to do batch redirection for commands with options
body: <p>I'm trying to run a series of commands that requires the user's password, so I'm asking for the password at the beginning of the script and redirect to the command using <code>|</code> (pipe redirection).</p>
  <p>In the documentation I found the syntax:</p>
  <pre><code>set password=secretpassword
  echo %password% | command that prompt for password
  </code></pre>
  <p>I tried with the scp command to copy one file from the server with the following code:</p>
  <pre><code>echo %password% | scp myuser@serverip:/home/myuser/myfile ./myfile
  </code></pre>
  <p>but didn't work.</p>
  <p>But this code works, for some reason:</p>
  <pre><code>echo %password | %scp myuser@serverip:/home/myuser/myfile ./myfile
  </code></pre>
  <p>I didn't understand why, maybe the interpretation of pipe inside %% is different.</p>
  <p>The main problem is when I pass options to the command, like to get a folder recursive, it doesn't work. Example:</p>
  <pre><code>echo %password | %scp -r myuser@serverip:/home/myuser/myfolder ./myfolder
  </code></pre>
  <p>I know that there are other better methods like using key pair authentication instead of a password, but I want to understand why it's not working.</p>