31
如何将此路径与此变量连接起来?连接网络路径+变量
$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