getting error with script

Welcome Forums General PowerShell Q&A getting error with script

This topic contains 1 reply, has 2 voices, and was last updated by

 
Member
3 years, 9 months ago.

  • Author
    Posts
  • #23410

    Participant
    Points: 0
    Rank: Member

    Hello,

    I am currently learning powershell and am trying to make a script to display the current version of java that is install on the PC. When I use the command java -fullversion, it works outside of the script but in a script I get the following error
    java : java full version "1.8.0_40-b26"
    At line:1 char:1
    + java -fullversion
    + ~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: [java full version "1.8.0_40-b26":String] [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

    Can anyone telling me why I am getting this error and how to fix it?

  • #23411

    Member
    Points: 0
    Rank: Member

    Looks like it's one of those silly executables that writes stuff to stderr instead of stdout. PowerShell sees that and interprets it as an error sometimes (but doesn't do it in every host.)

The topic ‘getting error with script’ is closed to new replies.