Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'd really appreciate if anyone could tell me how i can create a BATCH script that will take a list of all files in a directory, strip the extension off of each file, and then use the resulting filename w/o extension in a calculation.
1)I dont know how to pipe the file names into the BATCH, as a replacable parameter, one at a time.
2)I dont know how to take a filename and strip off the extension.SOMEONE PLEASE HELP!!!!
Thanks!!!

Hi,
cls
@echo off
if %1!==}{! goto pass2
for %%a in (*.ZIP) do call %0 }{ %%a
goto end
:pass2
echo %2 >my.dat
if not exist tzmp md tzmp >nul
stripstr /s.ZIP my.dat new.dat
type new.dat >> tzmp\finish.dat
:endStrip string is a small program. Let me know via email if you want a copy.
Method 2
cls
@echo off
if %1!==}{! goto pass2
for %%a in (*.*) do call %0 }{ %%a
goto end
:pass2
if not exist tzmp md tzmp >nul
copy %1 tzmp
cd tzmp
ren %2 *.
cd..
:endThe above is the easier of the two.
Both of these were written on the fly so....
you may have to debug a little.I dont know how you intend to use them, but getting the extension off a file is easy.
You might also try dir/B my.txt then use a string search to get rid of all .* whatevers as well.
Hope this of some help. I dont bite just byte so dont be afraid to ask.....no gaurantee I know the answer but you never know.
Peace Goodwill and Happy Computing
World Library

![]() |
![]() |
![]() |

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