このパスをこの変数と連結するにはどうすればよいですか?
$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