This is how you would dynamically return a directory name based upon wildcard in string.
The full app version is unknown, but you know it begins with a 9. The end goal is to edit a text file in the unknown path.
$AppVersion = Get-ChildItem -Path "$env:APPDATA\TestFolder\9*" -Directory -Name $AppDataPath = "$env:APPDATA\Test\$AppVersion" $FilePath = "$AppDataPath\TheFileYouWantToEdit.txt"