Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6952451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:21:04+00:00 2026-05-27T14:21:04+00:00

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

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:21:04+00:00Added an answer on May 27, 2026 at 2:21 pm

    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. http://connect.microsoft.com/PowerShell

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I try to compile this Java program in the command prompt I get
When the command prompt opens and then just closes really fast (because there isn't
if I paste this into the command prompt by hand, it works, but if
I dont understand what is wrong. If I run this command in command prompt
I'm trying to figure out how to run Python programs with the Command Prompt
I am try to build my java application in command prompt, but it fails
when I run this command ffmpeg -i C:\user\test.wmv >C:\user\test.wmv_info.txt 2>&1 from command prompt it
I need a java method that will read command prompt output and store it
I use the VS2008 command prompt for builds, TFS access etc. and the cygwin
for e.g from command prompt I need to launch the exe with some switch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.