title: Running commands over Plink from PowerShell fails with "■e: not found"
body: <p>Thanks for your help. So I have a problem with my script. I am trying to convert my script from batch to PowerShell, mostly just to try to learn it so I am completely new to PowerShell but I know other languages so I am decent at programming. My script creates a <code>kivaCommands.txt</code> file that is then used in Plink to be executed on the server. My batch script works fine with Plink but when I converted to PowerShell the Plink line errors on the <code>-m</code> switch. I get </p>
  
  <pre><code>sh:  ■e:  not found
  </code></pre>
  
  <p>I get this error no matter what commands are in the txt file, even if the file is empty. The Plink line works fine if I pass it a single command to execute. This is the code I'm having trouble with.</p>
  
  <pre><code>$hostLogin = "myServer"
  $passwd = "myPassword"
  $command = "H:\kivaCommands.txt"
  
  C:
  cd \
  cd "Program Files (x86)\PuTTY"
  
  ./PLINK.EXE -ssh $hostLogin -P 22 -pw $passwd -m $command
  </code></pre>
  
  <p>The <code>cd</code> commands were the only way I could get it to work. I tried all other ways of giving the whole path and creating a variable for the path but Plink would not execute. </p>
  
  <p>So after more troubleshooting, I have narrowed it down to the file created. If I manually create the file it works fine but my script creates the file before calling Plink. I have tried three different ways to create the file</p>
  
  <pre><code>"exit ^| sqlplus / @kiva_extract $assessorYear" | Set-Content H:\kivaCommands.txt -Encoding Unicode
  
  "exit ^| sqlplus / @kiva_extract $assessorYear" | Out-File H:\kivaCommands.txt -Encoding Unicode
  
  "exit ^| sqlplus / @kiva_extract $assessorYear" &gt; H:\kivaCommands.txt
  </code></pre>
  
  <p>The file creates fine and looks right but Plink cannot open correctly.</p>