Search found 9 matches

by suadhm
08 Feb 2019 02:51
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Thank you! Ok, here is the the thing: I have created one bat script for managing multiple test database on my test virtual machine. On that machine I have Oracle databases (multiple versions), MSSQL Express, PostgreSQL and Oracle TimesTen database. I run the scripts without parameters, just double c...
by suadhm
07 Feb 2019 06:08
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Hi, I have another question. I got service names as parameters and now I need to check service state for all selected services. Like this: set "_stat=" set "%ERRORLEVEL%=" sc query "%param1%" | findstr RUNNING > nul if %ERRORLEVEL% == 1 set _stat=STOPPED if %ERRORLEVEL% == 0 set _stat=RUNNING echo %...
by suadhm
06 Feb 2019 06:31
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Great!

With this code I don't need previous one.

Thank you!!!


Best regards.
by suadhm
06 Feb 2019 05:54
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Great!

That code works!!

Thank you!!


Best regards.
by suadhm
06 Feb 2019 02:27
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Hi,
I tried both, after the batch and in batch, but output is not as expected.

I get this:

Code: Select all

CMD >par.bat
word1
word2
word3
word4
param!cnt!=word4
ECHO is off.
by suadhm
05 Feb 2019 08:14
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Thank you. When I execute your code I get: cmd> par.bat param!cnt!=word4 param1=word1 param2=word2 param3=word3 param4=word4 When I test parameters I get: cmd> echo %param1% %param1% But I need this: cmd> echo %param1% word1 How can I achieve this? you don't need an intermediate file, you can run th...
by suadhm
05 Feb 2019 07:40
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Input file contains just some words:

Code: Select all

word1
word2
word3
File is created from:

Code: Select all

sc query state= all | find "SERVICE_NAME" | find "SOME_SERVICE_NAME" > %temp%\_list.log
Regards.
by suadhm
05 Feb 2019 06:39
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Re: Load multiple parameters from file

Hi,
Thank you for the replay.

I got this:

Code: Select all

set param!cnt!=word1 & set /a cnt+=1
2
set param!cnt!=word2 & set /a cnt+=1
3
set param!cnt!=word3 & set /a cnt+=1
4
set param!cnt!=word4 & set /a cnt+=1
5
For four words in the file. Number of words in the file is variable.

Regards.
by suadhm
05 Feb 2019 05:45
Forum: DOS Batch Forum
Topic: Manage multiple databases services using batch script
Replies: 16
Views: 1958

Manage multiple databases services using batch script

Hi, I'm trying to load multiple lines from file and set each line as parameter. Here is my problem: 1. I have text file that contains several lines with one word 2. I count lines in file with: findstr /R /N "^" %temp%\_list.log | find /C ":" > %temp%\_count.log set /p C1=<"%temp%\_count.log" 3. I ne...