我有一个简单的myscript.ps1
从文件中提取的网址,从this tutorial采取:PowerShell和选择串访问文件 - 访问被拒绝
$input_path = 'd:\myfolder\*'
$output_file = 'd:\extracted_URL_addresses.txt'
$regex = '([a-zA-Z]{3,})://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)*?'
select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $output_file
我运行PowerShell中以管理员身份,然后键入:
D:/myscript.ps1
但对于大多数路径内d:\myfolder
我得到:
select-string : The file D:\myfolder\templates cannot be read: Access to the path 'D:\myfolder\templates' is denied.
使用WinSCP从FTP服务器复制文件夹。我试图去文件夹属性和勾选“只读”框比应用,但每次我重新输入属性它是“只读”(我不知道如果这是有关的问题)。
我在Windows 10
看起来像'd:\ MyFolder文件\ templates'是一个文件夹不是一个文件选择字符串可以工作。 – LotPings
您是否可以浏览以查看D:\ myfolder \ templates中的文件,并且如果您看到文件,您是否可以打开它们?这听起来像是一个ACL问题。 – TheMadTechnician
@TheMadTechnician是的,我可以打开和浏览这些文件夹没有任何问题。 – PolGraphic