CSV文件的文件位置 [英] File location for CSV file

查看:225
本文介绍了CSV文件的文件位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串,我不断收到错误尝试放置位置来保存文件。我需要所有的安全日志保存在C:\日志,但它仍然失败,当我尝试将它放在某处

  Export-Csv('security-log- {0} .csv'-f([DateTime] :: Now).ToString(MM-dd-yyyy))
pre>

解决方案

»它不断失败«作为一个问题描述不太有用。但是,如果您需要将日志保存在特定的文件夹中,那么将有助于在您正在写入的路径中包含该文件夹:

  Export-Csv('C:\ logs\security-log- {0} .csv'-f([DateTime] :: Now).ToString(MM-dd-yyyy))

然后你也可以简化一下:

  Export-Csv('security-log- {0:MM-dd-yyyy} .csv'-f Get-Date)


I have a string and I keep getting errors trying to place the location to save the file. I need all the security logs to be saved at C:\logs but it keeps failing when I try to place it somewhere

Export-Csv ('security-log-{0}.csv' -f ([DateTime]::Now).ToString("MM-dd-yyyy"))

解决方案

»It keeps failing« is less than helpful as a problem description. However, if you require the logs to be saved in a specific folder it would help to include that folder in the path you're writing to:

Export-Csv ('C:\logs\security-log-{0}.csv' -f ([DateTime]::Now).ToString("MM-dd-yyyy"))

Then you can also simplify a bit:

Export-Csv ('security-log-{0:MM-dd-yyyy}.csv' -f Get-Date)

这篇关于CSV文件的文件位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆