Created
          April 30, 2019 04:42 
        
      - 
      
- 
        Save noahpeltier/bfab8b1c515933ca78497d1607996257 to your computer and use it in GitHub Desktop. 
    Functino for building command strings dynamicaly to save to an array
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $command = New-Object -TypeName System.Text.StringBuilder | |
| $Array = New-Object -TypeName System.Collections.ArrayList | |
| function set-arg { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(ValueFromRemainingArguments)] | |
| [String[]]$param, | |
| [switch]$invoke = $false | |
| ) | |
| $arg = $param -join " " | |
| $command.Append(" $arg ") | |
| } | |
| Function get-arg() { | |
| Param( | |
| [switch]$clear, | |
| [switch]$invoke | |
| ) | |
| $command.toString() | |
| If ($clear) { | |
| $command.Clear() | |
| } | |
| If ($invoke) { | |
| iex $command.toString() | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment