batch file: open file with wild cards

Posted on 2004-11-29
Last Modified: 2012-05-05
I have a situation where I need users to open a file via a batch script
start c:\special\A6_flast.doc

As you can gather, the file is located in "c:\special" on each users PC, the problem is that while the file they need to open starts with "A6_" it's appended with their first letter of their name and full last name, ie: A6_mbolton.doc or A6_snayeenanajar.doc

How can I launch this file with a batch script? (which I intend to email the users)

  start c:\special\A6_*.doc
won't work

Unfortunately, mbolton and snayeenanajar are not valid network user names, so I can't use the %username% environmental variable in the batch file
Question by:Marketing_Insists
    LVL 5

    Accepted Solution

    If it's the only file in the folder you can use the FOR statement:

    FOR %%c IN ("C:\Special\*.doc") DO START %%c

    Author Comment


      FOR %%c IN ("C:\Special\A6_*.doc") DO START %%c

    works perfect, thanks

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Sapphire RAGE 128 Pro 32M - Windows 2000 Driver 2 922
    Migrate Windows NT to Windows 2003 2 483
    website 1 292
    Repair old Windows 2000 boot 15 191
    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    730 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

    15 Experts available now in Live!

    Get 1:1 Help Now