I am trying to cut specific content from a string and store it in a variable to use later.

The string is : 

```
\\path\shares\Product\Product_Name\Custom\Version\Version_1\Packages\2018-05-31_07-33-12\PRODUCT_NAME_1_SETUP.exe

```

How can I cut the part in caps(`PRODUCT_NAME_1_SETUP`) and store it in variable in powershell.

I'd really appreciate help.

The path is actually stored in a variable called path\_name, and I'm trying the following:

$build\_name=[io.path]::GetFileNameWithoutExtension('$($path\_name)')

But it is not working. I'm getting O/P "$path\_name" only. :(

Even $build\_name=(Get-Item '$($path\_name)').Basename is failing too.