英文:
Power shell to output script to logfile
问题
$date = "12/31/2016"
Get-ChildItem T:\ -Recurse | where{$_.LastWriteTime -le [DateTime]$date}
英文:
i have this script to get all files not not accessed since 12/31/16. it runs fine, but how can i output the results to a log file ?
<pre><code>
$date = "12/31/2016"
Get-ChildItem T:\ -Recurse | where{$_.LastWriteTime -le [DateTime]$date}
</code></pre>
答案1
得分: 0
像这样,将数据传输到 Out-File 命令?
$date = "12/31/2016"
Get-ChildItem T:\ -Recurse | Where { $_.LastWriteTime -le [DateTime]$date } | Out-File oldfiles.log
英文:
Like this, piping to Out-File cmdlet?
<pre><code>
$date = "12/31/2016"
Get-ChildItem T:\ -Recurse | Where { $_.LastWriteTime -le [DateTime]$date } | Out-File oldfiles.log
</code></pre>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论