我已经使用 Powershell 一天了,我需要使用循环返回文件夹中每个文件的文件名。这是我目前拥有的:
$filePath = 'C:\Users\alibh\Desktop\Test Folder' #the path to the folder
cd $filePath
Get-ChildItem $filePath |
ForEach-Object{
$fileName = "here is where I return the name of each file so I can edit it
later on"
}
Run Code Online (Sandbox Code Playgroud)
我想比较文件夹中不同文件的名称,然后编辑或删除文件;但在此之前,我首先需要能够依次获取每个文件的名称。
编辑:非常感谢大家
powershell ×1