Computing.Net > Forums > Programming > Bat to find / display file IF ext.

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.

Bat to find / display file IF ext.

Reply to Message Icon

Name: tImmaY
Date: February 15, 2005 at 19:51:47 Pacific
OS: Windows XP Home SP2
CPU/Ram: AMD Athlon XP 2400+ / 512
Comment:

hey, what command would i use to find all the files in the current directory with a given extension? i thought i could use the if exist command, but idk how i would display the filename. like: if exist *.shibby echo %filename%
? lol or is there a better way. i'm using it in a program i'm writing in C for fun with the system() command. thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: February 15, 2005 at 21:24:00 Pacific
Reply:

attrib *.ext

M2


0

Response Number 2
Name: wizard-fred
Date: February 16, 2005 at 00:33:58 Pacific
Reply:

dir *.ext

if you need a list that the program can work on
dir *.ext > ext.lst

I don't do C, but in some versions of BASIC there is a system command that can return the the file name directly to the program. There may be the equivalent in some C file function library.


0

Response Number 3
Name: Mechanix2Go
Date: February 16, 2005 at 00:41:08 Pacific
Reply:

Hi wizard fred,

I don't do C either.

I'm working on something to get XMS mem size and do a little math and set an environ var.

I was planning to use C/C++ with inline asm.

Do you think BASIC [GWBASIC / QBASIC] would be up to the task?

TIA

M2


0

Response Number 4
Name: wizard-fred
Date: February 16, 2005 at 01:25:09 Pacific
Reply:

Mechanix2Go: Was this post 15438, Ramsize Sniffer, Original Poster - Gratis?

I was going to post a solution using a combination of BAT file and BASIC programming to resize RAMDISK using XMSDSK.

Gratis's objectives of building a Mini-W98 system was a bit confusing. And I didn't want to do a setup to try it.

I find no problem in extracting the values from the saved MEM display and from autoexec.bat. I use an old 16-bit version of PowerBasic. I don't know about GWBASIC or QBASIC, I have a problem of having the interpreter starting and exitting cleanly. PowerBasic and also QuickBasic compile to EXE's and can accept command line parameters.

More discussion would be welcome.


0

Response Number 5
Name: Mechanix2Go
Date: February 16, 2005 at 01:55:55 Pacific
Reply:

Hi wizard,

Yes, It's Gratis' project I have in mind.

MEM.EXE is 32K, so if this is not used, that much space is saved.

And the command line calc is 12K.

He sent me his disk IMZ this AM and I made the disk but haven't booted on it yet.

I only have one box and I'm busy readin' & writin' & lisyening to music.

Best regards.

M2


0

Related Posts

See More



Response Number 6
Name: JackG
Date: February 16, 2005 at 05:41:33 Pacific
Reply:

In a Batch file you would use:

FOR %%i IN (*.exe) DO ECHO %%i

Which allows you to do things like CALL all the *.exe programs in sequence with one command.

So you could send a command like:

FOR %i IN (day??.exe) DO CALL %i

to execute a group of programs.


0

Response Number 7
Name: wizard-fred
Date: February 16, 2005 at 09:47:24 Pacific
Reply:

Unless you can find another MEM program that is smaller. I assumed from the description of the project that it would have to run from a CD. The mem program only uses memory while executing. I assume that after the Ram disk was set the only thing using memory is the DOS environment, the required drivers and the ramdisk. I see no problem of installing the sizing part on a floppy, but whatever follows (the Win install) is not going to be run from the floppy.

My procedure
(at end of autoexec.bat)
...
mem > mem.lst (create text file)
checkram (read mem.lst and autoexec.bat to
determine the new ramsize, write
resize.bat)
call resize (resize ramdisk if needed)
...


As previously stated, I don't know what follows, except possibly an attempt to load and run Windows from the ramdisk.


0

Response Number 8
Name: Mechanix2Go
Date: February 16, 2005 at 14:46:22 Pacific
Reply:

Hi wf.

Like you, I don't know where he's going with this. But interesting stuff.

I booted his IMZ.

The xmsdsk csn load/unload from command line.

Pretty cool.

As I suspected,
it will "scale back" to available XMS.

As does smartdrv, etc.

I need to get back to him and check why he feels it necessary to "sniff 'n size".

Best regards.


M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






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: Bat to find / display file IF ext.

Batch file to find newest files www.computing.net/answers/programming/batch-file-to-find-newest-files/16808.html

Bat to rename 1 file to next avail www.computing.net/answers/programming/bat-to-rename-1-file-to-next-avail/17845.html

File search / locate Batch file. www.computing.net/answers/programming/file-search-locate-batch-file/17182.html