Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Joining multiple txt files andadding part of file name to each row  (Read 2648 times)

0 Members and 1 Guest are viewing this topic.

wasimsono

    Topic Starter


    Newbie

    • Experience: Experienced
    • OS: Windows 7

    I have came here by refereing someone to use the link https://www.computerhope.com/forum/index.php?topic=135977.0. I know that the topic is very old but I have some issues as under:

    I have two batch files named as : 1) Combine.bat 2) Picenquiry.bat

    The contents of Combine.bat file are as:
    Code: [Select]
    @echo off
    for %%A in (*.txt) do (
      echo Processing file '%%A'

      FOR /F "delims=" %%L in (%%A) do (
        ECHO %%L%%A >> DataFile.txt
      )
    )
    and contents of Picenquiry.bat are as:
    Code: [Select]
    @echo off
    ren "F:\meter_pictures\??????rc*." *.txt
    call "F:\meter_pictures\combine.bat"
    I am using a button on form and following code is used for click on button:
    Code: [Select]
    strReportpath = "F:\meter_pictures\"
    Shell strReportpath & "Picenquiry.bat"

    Unfortunately It runs but only run Picenquiry.bat file and do not run Combine.bat file as it is called in this batch file.

    But when I run Picenquiry.bat file directly without using VBA i.e. by double clicking file name, it runs and make "DataFile.txt".

    What mistake I am doing? Please help me. Its urgent.