Search found 13 matches
- 25 Aug 2023 01:51
- Forum: DOS Batch Forum
- Topic: Pass parameter to powershell command from bat script
- Replies: 0
- Views: 34157
Pass parameter to powershell command from bat script
Hi, Is there any way that I can pass parameter in batch script to powershell command executed by that script. Script is like this: echo. set /p PROC=Enter Proces Name: echo. $TrackProcessName = "*%PROC%*" $EstablishedConnections = Get-NetTCPConnection -State Established |Select-Object -Property Loca...
- 18 Aug 2023 00:39
- Forum: DOS Batch Forum
- Topic: Command output formatting
- Replies: 4
- Views: 5875
Re: Command output formatting
Hi Aacini, That's great, it works as expected. Thank you very much! All mentioned are columns from command output: C:\Users\Administrator>crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -----------------------...
- 17 Aug 2023 04:36
- Forum: DOS Batch Forum
- Topic: Command output formatting
- Replies: 4
- Views: 5875
Re: Command output formatting
Hi, "Resource Type" is obtained combining "Local Resources" and "Cluster Resources" from original command, and "State" is obtained by combining "STATE" and "SERVER" from original command. Output on Windows does not need to look same as on Linux. It need to be just simple to read. May be it can look ...
- 16 Aug 2023 01:00
- Forum: DOS Batch Forum
- Topic: Command output formatting
- Replies: 4
- Views: 5875
Command output formatting
Hi, I have to produce command output on Windows machine on similar way that I can produce it on Linux machine. Command is: crsctl stat res -t And its output on Windows machine is: C:\Users\Administrator>crsctl stat res -t ------------------------------------------------------------------------------...
- 08 Feb 2019 02:51
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
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...
- 07 Feb 2019 06:08
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
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 %...
- 06 Feb 2019 06:31
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
Re: Load multiple parameters from file
Great!
With this code I don't need previous one.
Thank you!!!
Best regards.
With this code I don't need previous one.
Thank you!!!
Best regards.
- 06 Feb 2019 05:54
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
Re: Load multiple parameters from file
Great!
That code works!!
Thank you!!
Best regards.
That code works!!
Thank you!!
Best regards.
- 06 Feb 2019 02:27
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
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:
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.
- 05 Feb 2019 08:14
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
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...
- 05 Feb 2019 07:40
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
Re: Load multiple parameters from file
Input file contains just some words:
File is created from:
Regards.
Code: Select all
word1
word2
word3
Code: Select all
sc query state= all | find "SERVICE_NAME" | find "SOME_SERVICE_NAME" > %temp%\_list.log
- 05 Feb 2019 06:39
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
Re: Load multiple parameters from file
Hi,
Thank you for the replay.
I got this:
For four words in the file. Number of words in the file is variable.
Regards.
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
Regards.
- 05 Feb 2019 05:45
- Forum: DOS Batch Forum
- Topic: Manage multiple databases services using batch script
- Replies: 16
- Views: 17005
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...