如何使用 powershell 关闭创建的文件
How to close a created file using powershell
我编写了一个 powershell 脚本,并使用 covertto-csv 将内容转储到已读入我的代码中。将所有内容写入 csv 文件(我使用 covertto-csv 创建)后,我使用同一文件作为另一个程序的参数,我 运行 来自同一脚本。作为输出,成功创建了一个 csv,但是当另一个程序访问该 csv 时,我收到 FileAccess 错误。这怎么能解决?
你可以用两种方法解决这个问题:
将您的文件复制到另一个地方然后使用它:
Copy-Item -Path "somepath" -Destination "newpath"
然后使用它。
停止使用此文件的进程:
get-process -name *Process name that using the file* | stop-process
我编写了一个 powershell 脚本,并使用 covertto-csv 将内容转储到已读入我的代码中。将所有内容写入 csv 文件(我使用 covertto-csv 创建)后,我使用同一文件作为另一个程序的参数,我 运行 来自同一脚本。作为输出,成功创建了一个 csv,但是当另一个程序访问该 csv 时,我收到 FileAccess 错误。这怎么能解决?
你可以用两种方法解决这个问题:
将您的文件复制到另一个地方然后使用它:
Copy-Item -Path "somepath" -Destination "newpath"
然后使用它。
停止使用此文件的进程:
get-process -name *Process name that using the file* | stop-process