Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 162 Vote(s) - 3.72 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does Powershell forget to set ERRORLEVEL on parser errors?

#1
In a command prompt, Try this out:
> powershell aaa
>
> echo ErrorLevel is %errorlevel%

Powershell will **fail** (with an error). You will also see "**ErrorLevel is 1**". This is because it runs *aaa* as a script, which makes an unhandled error, which sets the errorlevel.

However, now try this:
> powershell '
>
> echo ErrorLevel is %errorlevel%

Powershell will **fail** (with an error). This time, you will also see *"**ErrorLevel is 0**"*.

I realize it's a different problem. Powershell even will say it's a **ParserError**, and it's because I screwed up the command line arguments. Still, ***that's not cool***.

I am unclear as to why it behaves this way. I'm guessing this was an oversight. Other programs out there neglect setting errorlevel on failures, but in this case it's as if they went halfway. It's even **setting it to 0** here as opposed to not setting it at all.
Reply

#2
Hmm I think I agree that a parse error should set the return code to non zero. I suggest filing this over at the the Powershell connect site.

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through