I have stumbled the unfortunate situation, having to be in a directory in which another directory is located:
C:\Test\[Folder with unknown name]\theFileINeed.txt
The structure mentioned above originates from a Zip-file from an external source. So i can not change the structure.
My goal is to navigate to the Directory with the unknown name, so it is my working directroy and I can execute further commands there. (Like Get-Childitem e.g.)
Is there a simple way to e.g. use the cd
command to move into that directory?
I have fiddled around a bit with Resolve-Path
but couldn't find a helpful solution.
Thanks in advance.
dir C:\Test\*\theFileINeed.txt | ForEach-Object { $_ | Split-Path -Parent }
ordir C:\Test\*\theFileINeed.txt | Split-Path -Parent
– JosefZ