无法读取文件的内容 [英] unable to read contents of file

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

问题描述

我正在尝试读取文件的内容:

$releaseNotesPath = "$(System.DefaultWorkingDirectory)\_ccp-developccpccpReleaseNotesReleaseNotes"
$latestReleaseNotesFile = Get-ChildItem -Path $releaseNotesPath -Filter *.txt | Select-Object FullName,Name | Sort-Object -Property Name | Select-Object -First 1

问题出现在此处:

$releaseNote = Get-Content $latestReleaseNotesFile


2021-11-14T14:29:07.0729088Z ##[error]Cannot find drive. A drive with the name '@{FullName=D' does not exist.
2021-11-14T14:29:07.1945879Z ##[error]PowerShell exited with code '1'.

我做错了什么?

推荐答案

您需要提供文件路径(FullName):

$releaseNote = Get-Content $latestReleaseNotesFile.FullName

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

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