multiple arguments - how to script - quick question

Welcome Forums General PowerShell Q&A multiple arguments - how to script - quick question

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 4 months ago.

  • Author
  • #5499

    Topics: 1562
    Replies: 0
    Points: 0
    Rank: Member

    by chz013 at 2013-02-01 16:50:51

    Hi All

    How do we script with multiple arguments ?
    We think the 1-liner argument in $argument below is a little too long.

    $arguments = @(
    "-Xmx512m -jar C:\test\test.jar -mode=silent -smallxml=C:\test\test.xml -log=C:\test\test.log"
    $proc = Start-Process "java" -ArgumentList $arguments -Wait -PassThru

    Is there a case statement equivalent in powershell to find the exit code of $proc ?
    How do we do that ?


    by DonJ at 2013-02-02 10:06:18

    Well, in terms of the argument being too long, I don't know what to tell you. If that's the argument that the command needs, it doesn't really matter how long it is. And, that's the correct way to pass the argument. You don't need to make it into an array – PowerShell would do that implicitly. I mean, you could use an actual array @("-Xmx512m","-jar c:\test\test.jar","-mode=silent") and so on. But that won't make it shorter.

    PowerShell does have a Switch construct that works similarly to a case construct. Read "about_switch" in the shell's help.

The topic ‘multiple arguments - how to script - quick question’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort