BAT file to search a mapped directory

Posted on 2009-02-20
Last Modified: 2013-11-29

I need to create a bat file that will allow a user to enter a name or part of a name and then have it search the mapped drive and open the result.

Is this even possible. I know search would do that, but I am looking for something faster.

Any ideas?
Question by:Plaintree_Systems
    1 Comment
    LVL 2

    Accepted Solution

    @echo off
    set /p filename="Enter name of file: "
    set /p drive="Enter Drive (Q:, or Z:) to search for file: "

    Rem assume that the user enter filename and drive correctly
    cd \
    dir /b /s | find "%filename%"

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now