Hi developer,
I have already made script in windows powershell.
For example: Two integers variables then sum ( {5,5} make 10. )
Here is my script:
function TwoValues($input)
{
$regex = "({.*?})"
$matchInfo = @($input | Select-String -Pattern $regex -AllMatches)
$dictionary = @{}
foreach($minfo in $matchInfo)
{
foreach($match in @($minfo.Matches | Foreach {$_.Groups[0].value}))
{
$element = $match.Substring(1, $match.Length - 2);
[array]$value = $element.Split(',');
[int]$add = [int]::Parse($value[0]) + [int]::Parse($value[1])
$dictionary.Add($add)
}
}
return $dictionary
}
Write-Host "Number of Arg=" $args.Length
foreach($arg in $args)
{
$twoValues = TwoValues($arg)
Write-Host "$twoValues"
}The function is fine but the only problem is command line argument.
I put .\....ps1 {5,5} in powershell command line argument. i got display output and it says:
Number of Arg= 1
System.Collections.Hashtable
Any Idea?
Thanks