title: How to disable common parameter parsing in PowerShell functions?
body: <p>I'd like to disable PowerShell's "common parameters" for one of my functions. I've been working on a set of extensions to p4.exe (the Perforce command line utility) by writing a function something like this:</p>
  
  <pre><code>function p4(
      [parameter(valuefromremainingarguments=1)]
      [string[]]$cmdline)
  {
      # ...do some fun stuff with $cmdline...
      p4.exe $cmdline  # for illustration only - actual implementation uses .net objects
  }
  </code></pre>
  
  <p>The point is to be able to use p4 just like I normally do on the command line, except sometimes magically some parameters will get reprocessed (to add new commands or call different tools or whatever) and it will always feel as if I'm just using the normal p4 command line.</p>
  
  <p>This is working pretty well, until I start using a parameter like '-o'.</p>
  
  <pre><code>p4 -p 1666 user -o scobi
  </code></pre>
  
  <p>In this case, I get an error from PowerShell:</p>
  
  <pre><code>p4 : Parameter cannot be processed because the parameter name 'o' is ambiguous. Possible matches include: -OutVariable -OutBuffer.
  </code></pre>
  
  <p>The only way I've found around it is to quote my parameters:</p>
  
  <pre><code>p4 -p 1666 user '-o' scobi
  p4 '-p 1666 user -o scobi'
  </code></pre>
  
  <p>Yucky, and gets in the way of my goal of having this function be a transparent superset of p4.exe.</p>
  
  <p>Is there a magic attribute I can attach to my function to make it tell the shell "I don't support common parameters"? Or are there any other ways around this?</p>