0

I have a batch file with this command

wget www.example.com || powershell.exe command

example.com returns 1 or 0 as content-type plaintext

But whether it returns 1 or 0 powershell.exe command doesn't get run. I expect a response of 0 to lead to the powershell command being executed

The length of the response is 1 as expected.

Hard worker
  • 3,916
  • 5
  • 44
  • 73
  • possible duplicate of [How do I get the application exit code from a Windows command line?](http://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line) – sashoalm Mar 28 '15 at 21:03

1 Answers1

0

If wget utility returns errorlevel exit code 0 or 1, you should use

wget www.example.com && powershell.exe command

or

wget www.example.com
if %errorlevel% equ 0 powershell.exe command

Resources:

Sidenote: In prime version of my answer, in doubt about wget utility output (displays 0 or 1 only, or returns that exit code?), there was an attempt for the first case (display) with next resource: for /F Loop against the results of a command. Being led by l'L'l's comment, I removed this part :)

Community
  • 1
  • 1
JosefZ
  • 28,460
  • 5
  • 44
  • 83