Hello,
I'm beginning to write some PowerShell scripts to check log files.
I'm working with 2 hash tables $ini and $ini2 with is put inside $ini
I try to use the following command line to put a regex in a variable :
$base_folder = ([regex]"([_\w:\\]*)").matches($ini.$ini2["base"]) | foreach {$_.Groups[1].Value}
$check = Test-Path -path $base_folder
echo "--$base_folder--"
$base_folder is returning something like -- D:\data\dump_base --
I'm getting some space witch or not present in the source file :
base="D:\data\dump_base"
Thanks in advance
you could try this:
...foreach {$_.Groups[1].Value.Trim()}