You are not logged in.

#1 23 Jul 2014 09:40

Rulezz
Member
Registered: 23 Jul 2014
Posts: 5

Import data from a .csv file into a batcfile.

Heya,

I need some help here. I am trying to automate a scan of standalone hosts. What I have is a .csv file containing the IP-address, username and password for every host.

What i want to do is creating a batchfile for every single IP-address. Were the data from the .csv file is placed

rvtools.exe -s <ip-address> -u username -p <password> -c ExportAll2csv -d

in that string instead of the <ip-address>, <username> and <password>.

Best regards
R

Offline

#2 01 Aug 2014 20:21

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: Import data from a .csv file into a batcfile.

I'm not entirely sure what you are trying to do, but you may find the quickest /easiest method is to open the CSV in Excel and then add a column with a string expression that makes the command you want to run.

Then copy that column into a batch file and run it.

The alternative is to write a FOR /F command that parses the CSV file, extracts the 3 tokens and writes the command.

Offline

#3 02 Aug 2014 02:13

foxidrive
Member
Registered: 04 Apr 2013
Posts: 339

Re: Import data from a .csv file into a batcfile.

Simon Sheppard wrote:

The alternative is to write a FOR /F command that parses the CSV file, extracts the 3 tokens and writes the command.


Yes, and here's a framework:

@echo off
for /f "usebackq tokens=1,2,* delims=," %%a in ("file.csv") do (
   rvtools.exe -s %%a -u %%b -p %%c -c ExportAll2csv -d
)
pause

Note that usernames with commas inside it will break this.

Offline

#4 04 Aug 2014 11:53

Rulezz
Member
Registered: 23 Jul 2014
Posts: 5

Re: Import data from a .csv file into a batcfile.

Thanks for the help smile It worked

Offline

Board footer

Powered by