Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 将变量输出到文本文件_Powershell_Powershell 2.0 - Fatal编程技术网

Powershell 将变量输出到文本文件

Powershell 将变量输出到文本文件,powershell,powershell-2.0,Powershell,Powershell 2.0,我想将一些变量输出到日志文本文件。这就是我现在正在做的 ' Copying $DevRoot\$File to $RemoteRoot\$ServerName\$File' >> $LogFile 但它输出的正是 Copying $DevRoot\$File to $RemoteRoot\$ServerName\$File 我做错了什么?使用双引号而不是单引号。双引号告诉PowerShell在呈现之前解释任何变量或转义字符,而单引号按字面解释。使用双引号而不是单引号。双引号告诉P

我想将一些变量输出到日志文本文件。这就是我现在正在做的

' Copying $DevRoot\$File to $RemoteRoot\$ServerName\$File' >> $LogFile
但它输出的正是

Copying $DevRoot\$File to $RemoteRoot\$ServerName\$File

我做错了什么?

使用双引号而不是单引号。双引号告诉PowerShell在呈现之前解释任何变量或转义字符,而单引号按字面解释。

使用双引号而不是单引号。双引号告诉PowerShell在呈现之前解释任何变量或转义字符,而单引号则按字面解释