Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Retrieve the path of the file

Reply
 
Old 09-26-2008   #1 (permalink)
AdityaKir


 
 

Retrieve the path of the file

Hi,

I have a requirement where in I know the name of the file. But do not know
the complete path of its location. Moreover the machine will be having
atleast 3 drives. Is there any way to retrieve the path of the specified File
only by giving the name.


Thanks,

Aditya

My System SpecsSystem Spec
Old 09-26-2008   #2 (permalink)
Keith Hill [MVP]


 
 

Re: Retrieve the path of the file

I think this requires a brute force approach:

'c:\','d:\','e:\' | get-childitem -r -filter *.txt -force | where
{!$_.PSIsContainer -and $_.name -eq $filename}

For $filename specify the entire filename that you want to match including
the extension. For the command above I assumed a filter of .txt, change
that to whatever extension the file you're looking for uses.

--
Keith

"AdityaKir" <AdityaKir@xxxxxx> wrote in message
news:39BF9223-4A0E-4715-973E-0211FC44A78B@xxxxxx
Quote:

> Hi,
>
> I have a requirement where in I know the name of the file. But do not
> know
> the complete path of its location. Moreover the machine will be having
> atleast 3 drives. Is there any way to retrieve the path of the specified
> File
> only by giving the name.
>
>
> Thanks,
>
> Aditya
My System SpecsSystem Spec
Old 10-05-2008   #3 (permalink)
Flowering Weeds


 
 

Re: Retrieve the path of the file

Quote:

>I think this requires a brute force approach:
>
> 'c:\','d:\','e:\' | get-childitem
Or the same ways one,
in other Windows processes,
uses many other Windows tools
to find files!

Where.exe

The automation (PowerShell) tool's
cmdlet get-command where.exe
returns:

FileDescription:
Where - Lists location of files

Product:
Microsoftr Windowsr Operating System

Or another Windows tool

LogParser.exe -h -i:fs

returns:

Input format: FS (FileSystem properties)
Returns properties of files and folders

Yep there are many Windows tools
(where.exe, powershell.exe, logparser.exe
and etc.) that can help one find files!


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Retrieve file from Recycle Bin issue General Discussion
How to retrieve the latest file PowerShell
Retrieve File System Object Descriptions For Executables PowerShell
Retrieve file version information PowerShell
Script to retrieve file versions VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46