I would like in my script to use wildcard in variable like this :
$TARGET = "\\MACHINE1\c$\ProgramData\Test\12.*\Data\"
The problem is $TARGET returns
\\MACHINE1\c$\ProgramData\Test\12.*\Data\
and not
\\MACHINE1\c$\ProgramData\Test\12.1.1.1\Data\
However
Test-Path "\\MACHINE1\c$\ProgramData\Test\12.*\Data\"
=> TRUE
Thanks for your help
The Best in this cases IMO is using Resolve-Path,
$TARGET = Resolve-Path "\\MACHINE1\c$\ProgramData\Test\12.*\Data\" | Select -ExpandProperty Path