C
C
Cyril2017-07-11 19:34:19
PowerShell
Cyril, 2017-07-11 19:34:19

How to get the result of a PW script execution in a BAT file?

Calling a PowerShell script from a BAT file. I want to check the call field in the BAT file, what value is returned - an empty string or not empty . If the string is empty, then go to section sec_1, if not empty, then sec_2. Can you tell me how to check the returned data from a PowerShell script in a BAT file?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MrDywar Pichugin, 2017-07-11
@Dywar

BAT starts a process, and it can return 1 or 0 at the end of its work, just like any other.
The environment variable is called ~ErrorLevel.
How do I get the application exit code from a Wind...

A
Alexander Kuznetsov, 2017-07-12
@DarkRaven

This is how I got the date from PowerShell in the BATCH file:
I think you can customize it for yourself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question