【发布时间】:2015-02-02 06:53:07
【问题描述】:
我正在尝试运行以下 PowerShell 脚本:
$server=MACHINE_NAME
if (Test-Path \\$server\c$\test.txt) {$server"/yes`n" | out-file c:\log.txt -append}
else {$server"/no`n" |out-file c:\log.txt -append}
当我尝试运行它时,我得到:
表达式或语句中出现意外标记“/yes”。在 line:2 char:44
不允许使用空的管道元素。在 line:2 char:53
表达式或语句中出现意外标记“/no”。在 line:3 char:13
不允许使用空的管道元素。在 line:3 char:21
我预计这是我没有看到的简单事情。我对 PowerShell 很陌生。
【问题讨论】:
标签: powershell