如何访问网络驱动器中的文件以搜索该文件中的字符串? [英] How to access files in network drive to search for a string in that file?
问题描述
我在windows powershell中使用下面的代码来搜索字符串,并在找到字符串时将文件名作为输出。
$ a = Get-ChildItem -r | ? {$ _.psiscontainer -eq $ false} | ? {gc $ _.pspath | select-string -patternerr}
写主机文件包含错误代码错误:$ a
但我想搜索文件在下面给出的共享位置,该位置受用户名和密码保护,可以提供
共享位置:\\d1dal723 \prdload
用户名:abc \ xxyyzz
密码:asdfghj @ 123
请帮我在该共享路径中搜索和显示文件名。
先谢谢。
I am using below code in windows powershell to search for a string and give filename as output if string is found.
$a=Get-ChildItem -r | ? {$_.psiscontainer -eq $false} | ? {gc $_.pspath |select-string -pattern "err"}
Write-host " Files with error code ERROR : $a
but i want to search files in a shared location which is given below which is protected by username and password which can be supplied
shared location : \\d1dal723\prdload
username : abc\xxyyzz
password : asdfghj@123
Please help me to search and display file names in that shared path .
Thanks in Advance.
推荐答案
a = Get-ChildItem -r |?{
a=Get-ChildItem -r | ? {
_。psiscontainer -eq
_.psiscontainer -eq
false} |?{gc
false} | ? {gc
这篇关于如何访问网络驱动器中的文件以搜索该文件中的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!