I am running a script which has $FileName variable containing the absolute path with spaces. Due to the space within the directory name and file name, the script fails to executes without finding the actual path. All I need is to add $FilePath within double quotes. How should I append double quotes in the beginning and end of a string?
For example
"X:\Movies\File One\File One.txt"
Script:
$FilePath = Join-Path $Path $($Dir + "\" + $File + “.txt”)
$FilePath
Current OutPut:
X:\Movies\File One\File One.txt
"'$path\$dir\$file.txt'"
$FilePath = Join-Path $Path $($Dir + "\" + $File + ".txt")
could be re-written as$FilePath = Join-Path $Path (Join-Path $Dir ($File + ".txt"))