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.