如何将此路径与此变量连接?
$file = "My file 01.txt" #The file name contains spaces
$readfile = gc "\\server01\folder01\" + ($file) #It doesn't work
谢谢
如何将此路径与此变量连接?
$file = "My file 01.txt" #The file name contains spaces
$readfile = gc "\\server01\folder01\" + ($file) #It doesn't work
谢谢
有几种方法。最简单的:
$readfile = gc \\server01\folder01\$file
你的方法很接近:
$readfile = gc ("\\server01\folder01\" + $file)
您还可以使用Join-Path例如:
$path = Join-Path \\server01\folder01 $file
$readfile = gc $path