# Open a folder in powershell

**URL:** <https://forums.powershell.org/t/open-a-folder-in-powershell/18624>\
**Category:** PowerShell Help\
**Created:** [February 19, 2022, 5:23am UTC](https://forums.powershell.org/t/open-a-folder-in-powershell/18624 "2022-02-19T05:23:22Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [February 19, 2022, 12:30pm UTC](https://forums.powershell.org/t/open-a-folder-in-powershell/18624/2 "2022-02-19T12:30:55Z")

</div>

Vikas,  
Welcome to the forum. 👋🏽

When you post code or sample data or console output please format it as code using the _preformatted text_ button ( **\</\>** ). Simply place your cursor on an empty line, click the button and paste your code.  
Thanks in advance

> [@Welcome to the new PowerShell Forums](https://forums.powershell.org/t/welcome-to-the-new-powershell-forums/7/6):
>
> How to format code in [PowerShell.org](http://PowerShell.org) forums. [Codeformatting\_1]

Since your date is in the format `yyyy.MM.dd` you could simply sort it by name and use the last found to find the folder wirh the latest date.

```auto
$Path = 'C:\Ps\degtf-ithuju'

Get-ChildItem -Path $Path -Directory |
    Sort-Object -Property Name |
        Select-Object -Last 1

```

If you want to go with the date time string you have several options … like this for example:

```auto
$DateTimeString = Get-Date -Format 'yyyy.MM.dd-*'
$DateTimeString = (Get-Date).ToString('yyyy.MM.dd-*')

```

And at the end you should enclose your path in quotes.

---

_[View the full topic](https://forums.powershell.org/t/open-a-folder-in-powershell/18624)._
