#1 21 Oct 2018 01:51

k100p
New Member
Registered: 21 Oct 2018
Posts: 1

Read a text file to connect to database!

Hi, I hope someone can help me. I am new to batch scripting. I want to read a file that has database names
and connect to each of them to get status and write output to a file. I'd like to do this from cmd command.

I really appreciate if I can get some help here.

Thanks in advance.

Offline

#2 21 Oct 2018 20:58

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,052

Re: Read a text file to connect to database!

If it's just a simple list, you can do something like this ... you'll have to fill in some of the details as you've not given a great deal to go on.

for /f "usebackq tokens=*" %%a in ("your_list_of_databases.txt") do (
   status_command %%a
)

cmd | *sh | Ruby | Chef | Puppet | PowerShell | AutoIT3

Offline

Board footer

Powered by FluxBB