Computing.Net > Forums > Disk Operating System > Creating a BATCH script

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.

Creating a BATCH script

Reply to Message Icon

Name: Jason I
Date: November 17, 1998 at 20:08:23 Pacific
Comment:

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!!!



Sponsored Link
Ads by Google

Response Number 1
Name: World Library
Date: November 18, 1998 at 13:52:14 Pacific
Reply:

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
:end

Strip 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..
:end

The 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


0
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 Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Creating a BATCH script

creating a batch file to rename fil www.computing.net/answers/dos/creating-a-batch-file-to-rename-fil/15089.html

Creating a batch file to append to a text file www.computing.net/answers/dos/creating-a-batch-file-to-append-to-a-text-file/3180.html

Batch Scripting in W2K www.computing.net/answers/dos/batch-scripting-in-w2k/11426.html