如何从ls获取fullname,path plus filename?

时间:2017-05-17 10:35:28

标签: powershell

我可以这样做:

<table class="sortable"></table>

但输出为PS C:\Builds\Main\> ls "C:\Builds\Main\Prod\Core\prodXML\prodXML\prodXMLElement.cpp" -Name

我想将ls的输出传递给一个控制台程序,该程序需要完整的文件名,包括目录,所以我想得到:

prodXMLElement.cpp

1 个答案:

答案 0 :(得分:3)

lsGet-ChildItem别名,因此您可以找到有关此here的大量信息(您也可以通过输入{{3}来查找此信息}})。要获得整个路径,只需省略-Name开关即可。根据管道目标的预期,您可能必须选择 FullName

示例:

Get-ChildItem -Filter '*.cpp' | Select-Object -ExpandProperty FullName