I am trying to create a function that will show me the whole path where a specific file name is located. The function will take one parameter, which is the file name. The result will be either a list of all paths, or a message stating that the system does not have such a file.
I am new to Powershell and I am not getting the syntax yet. I tried this:
Get-ChildItem -Path -Include notepad.exe
But this caused an error message. I'm trying now:
$i="notepad.exe"
Foreach ($i in Get-ChildItem c:\ -Recurse){echo -Path}
To begin with, it is still working now, I don’t know what will happen, really.
EDIT: echo'd a huge number of lines that just say "-Path" ...
Can anyone help to solve this problem? By the way, I am running Powershell 1.0.
, , , , *.txt:
C:/foo.txt
C:/A/foobar.txt
:/A1/foo.txt
, .txt . , , .
EDIT2:
. , .
( .zip , , ):
Get-ChildItem -Path c:\ -Include "*.zip" -Recurse -Force -Name > c:\listOfPaths.txt
listOfPaths.txt C: \, , .zip .
"c: \" , .
EDIT3:
capar .
capar ( , Get-Children 1.0)
Get-ChildItem -Path c:\ -Recurse *.txt | Select-Object -Property FullName