1.

Solve : Create a file using MS Dos?

Answer»

Hi,

I am trying to create a schema.ini file that contains information about all files in a directory using MS Dos. Here is what I am trying to do

Directory C:\Misc has the following tab delimited files without COLUMN headers

sample1.txt
sample2.txt
sample3.txt
sample4.txt

Now I need to create a schema.ini file using the above file names (extract file names from a directory). The new file would have the following text and would be saved as "schema.ini":

[Sample1.txt]
Format=TabDelimited
ColNameHeader=False
MaxScanRows=0
CharacterSet=ANSI
[Sample2.txt]
Format=TabDelimited
ColNameHeader=False
MaxScanRows=0
CharacterSet=ANSI
[Sample3.txt]
Format=TabDelimited
ColNameHeader=False
MaxScanRows=0
CharacterSet=ANSI
[Sample4.txt]
Format=TabDelimited
ColNameHeader=False
MaxScanRows=0
CharacterSet=ANSI

Can someone please show me how to write a ms dos code that will create this file (if dos can do this)? As far as i understand this, i need to do two THINGS: a) PASS file names in directory; b) add the standard text. I might be wrong here.

Regards

are this lines
Code: [Select]Format=TabDelimited
ColNameHeader=False
MaxScanRows=0
CharacterSet=ANSIand others are in each sample file or you want to echo them ?hello,

if by echo you mean to appear as normal text than yes, every single file name should be followed by these lines (these lines never change).here you go
Code: [Select]for /F %%a in ('dir /b path\tofiles\*.txt') do (
echo.[%%a]>>schema.ini
echo.Format=TabDelimited>>schema.ini
echo.ColNameHeader=False>>schema.ini
echo.MaxScanRows=0>>schema.ini
echo.CharacterSet=ANSI>>schema.ini
)
remember to change path to whatever you wanthello devcom,

thank you so MUCH for all your help, the code worked seamlessly, i got exactly what i was looking for.

thanks once again

regards



Discussion

No Comment Found