Computing.Net > Forums > Disk Operating System > Batch file help

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.

Batch file help

Reply to Message Icon

Name: Shay Harel
Date: August 6, 2003 at 12:43:05 Pacific
OS: 2000
CPU/Ram: P5 256
Comment:

Hi,

I was looking for some DOS help on something that looks simple but I just cant figure it out

I use a batch command like this
for %%i(in %1.a %1.b) type%1>>%1.y

which will add the *a and *.b to a *.y file
Now, if I want to write in the Y file the name of the file I inserted before I insert it, how do I do it ?

To explain i details:
Let's say I have a file me.a that contains the string "123" and a file "me.b" that contains the string "456", I want the me.y to look like that
me.a
123
me.b
456




Sponsored Link
Ads by Google

Response Number 1
Name: Secret_Doom
Date: August 6, 2003 at 21:02:30 Pacific
Reply:

The filename would be defined by %1, is that it? I mean, if the batch file is invoked with the first parameter as "hello", hello.a and hello.b will be 'logged' into hello.y, no other files, right? You mentioned "*.a and *.b", which was confusing...

This will do it:

for %%F in (%1.a %1.b) do (
    echo %%F>> %1.y
    type %%F>> %1.y
)

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


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: Batch file help

basic batch file help needed www.computing.net/answers/dos/basic-batch-file-help-needed/1019.html

DOS Batch file help www.computing.net/answers/dos/dos-batch-file-help/6382.html

batch file help please www.computing.net/answers/dos/batch-file-help-please/9905.html