Computing.Net > Forums > Programming > Execute output from a dir command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Execute output from a dir command

Reply to Message Icon

Name: squares
Date: January 10, 2008 at 00:23:53 Pacific
OS: Windows XP
CPU/Ram: Unsure
Comment:

Hello, I'm looking for a way to execute the output of a program.
For example I have a folder full of files named in various formats, but with a particular single digit, then two more digits later in the name. If I were to use dir /b *2*15* to find a particular file, how would I run it using it's filename extension (assuming we do not already know the extension.)
I thought this would work, but it doesn't:
dir /b *2*15* >
Typing the filename with it's extension works ordinarily, the extension is associated properly.

Thank you all very much for any time you can spend helping me with this.

- Gordon



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: January 10, 2008 at 01:07:01 Pacific
Reply:

You don't. You use the
FOR
command.

FOR %%a IN (*2*15*) DO START "" "%%a"


0

Response Number 2
Name: squares
Date: January 10, 2008 at 02:08:05 Pacific
Reply:

Works brilliantly, thank you very much Razor!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Execute output from a dir command

Display a system call in C++ www.computing.net/answers/programming/display-a-system-call-in-c/10868.html

Creating a variable from a txt file www.computing.net/answers/programming/creating-a-variable-from-a-txt-file/16486.html

DOS output in a windows program www.computing.net/answers/programming/dos-output-in-a-windows-program/4922.html