如何解决Powershell错误-意外的令牌错误
执行以下程序时出现错误。下面的方法将$ env:userprofile与路径连接起来是否正确?
$env:userprofile\Documents\DNS\GetDnsRecord.ps1 | ConvertTo-Csv -NoTypeInformation | Select-Object -Skip 1 | Out-File -Append $env:userprofile\Documents\DNS\DnsRecord.csv
错误:
+ $env:userprofile\Documents\DNS\GetDnsRecord.ps1 | ConvertTo-Csv -NoTy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '\Documents\DNS\GetDnsRecord.ps1' in expression or statement.
感谢您的帮助
约翰
解决方法
您可能需要阅读一些有关Join-Path的信息:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/join-path?view=powershell-7
Join-Path $env:userprofile '\Documents\DNS\GetDnsRecord.ps1'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。