If you need to construct a path from 2 strings you'd normally use the Join-Path
cmdlet, e.g. like this:
PS C:\> Join-Path 'C:\some\folder' 'file.ext'
C:\some\folder\file.ext
However, when handling existing files like you do, you could simply use the file object's FullName
property:
$FQNBackup = Get-ChildItem $BackupPath | Where-Object {
$_.LastWriteTime -gt "2014/02/01" -and $_.Name -like "$DBname*.bak"
} | Sort-Object LastWriteTime -Descending | select -First 1 -Expand FullName
Strings can be passed into functions via string arguments, e.g. like this:
function Foo {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]$Bar
)
# do stuff
}
Foo -Bar 'some string'