powershell script argument code example
Example 1: bash function arguments
#!/usr/bin/env sh
foo 1
foo() {
echo "Parameter #1 is $1"
}
foo 2
Example 2: parameter powershell
Param (
[Parameter(Mandatory=$True, Position=1)]
[string]$String,
[Parameter(Mandatory=$True)]
[int]$Int,
[switch]$Switch = $false
)
Example 3: how to parse command value in powershell
powershell -Command "(gc $env:userprofile\.android\avd\Nexus_4_API_23.avd\config.ini) -replace 'vm.heapSize=%getRam%','%setRam%' | Out-File -encoding ASCII $env:userprofile\.android\avd\Nexus_4_API_23.avd\config.ini"