Public/Get-specNewTargetPath.ps1

function Get-specNewTargetPath {
    <#
    .SYNOPSIS
        Replaces known placeholders in a target path with provided values.
 
    .DESCRIPTION
        This function takes a string representing a target path and replaces specific placeholder values
        (e.g., <EPOS>, <VFIELDS>, <STORENAME>) with the corresponding values passed as parameters.
 
    .PARAMETER TargetPath
        The string containing the target path with placeholders that need to be replaced.
        Placeholders include <EPOS>, <VFIELDS>, and <STORENAME>.
 
    .PARAMETER EPOS
        The value to replace the <EPOS> placeholder in the target path.
 
    .PARAMETER VFIELDS
        The value to replace the <VFIELDS> placeholder in the target path.
 
    .PARAMETER STORENAME
        The value to replace the <STORENAME> placeholder in the target path.
 
    .EXAMPLE
        Get-specNewTargetPath -TargetPath "C:\Path\<EPOS>\<VFIELDS>\<STORENAME>" `
                            -EPOS "9000" `
                            -VFIELDS "FieldData" `
                            -STORENAME "Store1"
        This will return the string `C:\Path\9000\FieldData\Store1` by replacing the placeholders
        with the corresponding values provided.
 
    .NOTES
        Author: owen.heaume
        Version: 1.0 - Intital release
    #>


    param (
        [string]$TargetPath,
        [string]$EPOS,
        [string]$VFIELDS,
        [String]$STORENAME
    )

    # Replace all known placeholders
    $newTargetPath = $TargetPath -replace '<EPOS>', $EPOS `
        -replace '<VFIELDS>', $VFIELDS `
        -replace '<STORENAME>', $STORENAME

    return $newTargetPath
}