gpt4 book ai didi

windows - Out-File 不写任何输出

转载 作者:可可西里 更新时间:2023-11-01 11:46:18 25 4
gpt4 key购买 nike

我有以下问题:

脚本没有在我的 export.txt 文件中写入任何内容,但它确实显示“找到文件!”...

$client = "my-workstation"
$file = "c$\Windows\System32\notepad.exe"
$export = "C:\temp\export.txt"

If(Test-Path "\\$client\$file")
{
write-host $client | Out-File $export
write-host "File found!"
}

最佳答案

Write-Host cmdlet 将消息写入控制台,它不会将任何内容放入管道,因此您必须省略写主机:

$client | Out-File $export

关于windows - Out-File 不写任何输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43933160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com