Solved

get file name in batch file

Posted on 2004-09-23
3
1,032 Views
Last Modified: 2008-03-17
Can I get file name in batch file:
1. Input a text string
2. find the file including input string in current dir
3. display the file name
0
Comment
Question by:Yuanyu
  • 2
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 50 total points
ID: 12139910
Not sure I completely understand, but depending on your OS - you can try:

@echo off
set /p filename=Which file would you like to search for?
dir .\%filename%
echo %filename%
0
 

Author Comment

by:Yuanyu
ID: 12139991
The string I inputed is only part of filename, for example, when I input '12', I like to get '*12*.*'
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 12142097
I didn't understand that from your original question - why did you accept this one if it wasn't a complete answer?
I shoot for an "A" grade, so...
Change the "dir" line to

dir .\*%filename%*

and that should do it for you! : )
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Backup solution 14 71
Combine multiple text files into one file 4 41
Help with a batch file 13 76
dsquery command line assistance 2 71
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

23 Experts available now in Live!

Get 1:1 Help Now