-1

If I run a program in cmd and the program needs a dll that is missing, an error dialog pops up showing this error. However, in PowerShell, no such dialog pops up, and the program silently quits without any hint. This is not good because I don't know if the program has run successfully(just no output) or did not run at all.

Is there an option in PowerShell that I can turn on to show this kind of error dialog?

4
  • Something along these lines? stackoverflow.com/questions/12359427/…
    – Danijel
    Commented Jun 9 at 12:06
  • 1
    I don't get what error dialog you could be referring to. Please provide a screenshot and maybe instructions to provoke the error.
    – Daniel B
    Commented Jun 10 at 18:35
  • Not wanting to write code isn't much of an excuse when you wrote the application yourself. Also, cmd and ps are two different things, so an application running in one should be expected not to behave the same running in the other. More details about your application, as well as an awareness that these are two different systems, even if they have significant overlap or cross-compatibility, is key to getting you to a good solution Commented Jun 18 at 19:00
  • @music2myear I think a better solution is to let MS fix the bug. To achieve that goal, we must let more people aware of that bug.
    – William
    Commented Jun 19 at 5:36

2 Answers 2

2
try {test.exe} catch {$Error[0]}

about_Try_Catch_Finally
about_Automatic_Variables

8
  • Thanks, but I do not want to write code. I run the program directly in a PowerShell window as in cmd window which shows the error dialog without any additional code.
    – William
    Commented Jun 9 at 15:40
  • @William So, what command do you run?
    – Mr.Key7
    Commented Jun 10 at 8:53
  • ,Key7 The program is written by myself which depends on a dll. I forgot to deploy that dll so the error occurred.
    – William
    Commented Jun 10 at 8:58
  • What is funny is that PowerShell does not seem that powerful. It seems less powerful than the old cmd. Apart from the talked issue, here is another example: in cmd I can run a program in current directory by just typing its name yourapp, but in PowerShell it cannot find the program and you have to type ./yourapp.exe.
    – William
    Commented Jun 10 at 9:08
  • 1
0

Is there an option in PowerShell that I can turn on to show this kind of error dialog?

No, there is no option in PowerShell that you can turn on to show error dialogs.

Errors can only be captured programmatically (see Mr.Key7's answer) or via examining output generated by a script.

Not the answer you're looking for? Browse other questions tagged .