0

I have a code to create a csv for my data query. However I have no idea on how to make it so I just can drag any file into it and then output the desired csv with the inputfilename.

    @ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
(ECHO test, severity, regulations, result, category, description, remediation, cveLink, details, data, score, dataRowCount)>parsed.csv
(FOR /F "tokens=2 delims=;" %%A in (data.txt) DO (
    SET /A "num+=1"
    SET "data=!data!,%%A"
    IF !num! EQU 12 (
        ECHO !data:~2!
        SET "num=0"
        SET "data="
    )
))>>parsed.csv
PAUSE
EXIT /B

I just want for example that I have different input files i.e: data120213.txt and serverdatacollection1234124.txt and it would output after draggint those files to the bat file.: data120213.csv and serverdatacollection1234124.csv

Victor J Mytre
  • 364
  • 1
  • 10
  • Take a look at [this](https://stackoverflow.com/q/26551) and [this](https://stackoverflow.com/q/357315) (any many more)... – aschipfl Jun 12 '19 at 14:52
  • I forgot to add that my knowledge on batch is not that strong, I am using it as the computers I am working have no admin rights nor java installed. – Victor J Mytre Jun 12 '19 at 15:25
  • Did you post the same question on [SuperUser](https://superuser.com/q/1447911) too? why? – aschipfl Jun 12 '19 at 15:47
  • time is limited for this issue, and I got my answer from over there actually. Not gonna limit my self to ask on just one page if I need this asap. I still saved those links to reference later. – Victor J Mytre Jun 12 '19 at 16:08
  • Possible duplicate of [How can I pass arguments to a batch file?](https://stackoverflow.com/questions/26551/how-can-i-pass-arguments-to-a-batch-file) – Francois Nadeau Jun 12 '19 at 18:21

0 Answers0