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

  • Home
  • SEARCH
  • 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 9173133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:31:05+00:00 2026-06-17T16:31:05+00:00

I want to call a wlst/jython script from powershell with arguments. (Here is a

  • 0

I want to call a wlst/jython script from powershell with arguments. (Here is a simplified version)

hello.ps1

 param (
    [string]$cmd = "none"
 )

echo "cmd - $cmd"
Switch ($cmd) {
     "hello" {
             Write-Host "Start hello ..."
             $script='C:\_WORK_\hello.py'
             & java -cp C:\bea\tpc\WEBLOG~1\server\lib\weblogic.jar weblogic.WLST $script
         }
     "main" {
             Write-Host "w main $cmd" 
             $cmd='-c "hello"'
             $script="C:\_WORK_\hello_main.py"
             Write-Host "script: $script"
             & java -cp C:\bea\tpc\WEBLOG~1\server\lib\weblogic.jar weblogic.WLST $script $cmd
     }
     Default {Write-Warning "Invalid Choice. Try again."
                  sleep -milliseconds 750}
    } #switch

hello.py

print "Hello without main/args"

hello_main.py

import getopt

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "hc:v", ["help", "command="])
    except getopt.GetoptError, err:
        # print help information and exit:
        print str(err) # will print something like "option -a not recognized"
        usage()
        sys.exit(2)
    command = None
    verbose = False
    for o, a in opts:
        if o == "-v":
            verbose = True
        elif o in ("-h", "--help"):
            usage()
            sys.exit()
        elif o in ("-c", "--command"):
            command = a
        else:
            assert False, "unhandled option"
    print 'command: '+command
    if (command == 'hello'):
        print "if hello"

if __name__ == 'main':
    main()

With “hello.ps1 -cmd main” the script terminates after “print ‘command: ‘+command”
i cannot figure out why

>powershell c:\_WORK_\SAS\hello.ps1 -cmd main
cmd - main
w main main
script: C:\_WORK_\SAS\hello_main.py

Initializing WebLogic Scripting Tool (WLST) ...

command:  hello

>powershell c:\_WORK_\SAS\hello.ps1 -cmd hello
cmd - hello
Status ...

Initializing WebLogic Scripting Tool (WLST) ...

Hello without main/args
  • 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-06-17T16:31:06+00:00Added an answer on June 17, 2026 at 4:31 pm
     "main" {
             Write-Host "w main $cmd" 
              $arg0 = "C:\_WORK_\SAS\hello_main.py"
              $arg1 = "-c"
              $arg2 = "hello"
    
              $allArgs = @($arg0, $arg1, $arg2)
    
             & java -cp C:\bea\tpc\WEBLOG~1\server\lib\weblogic.jar weblogic.WLST $allArgs
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call the variable from the script to body. Here is my
I want call execution for a myScript1.ps1 script inside a second myScript2.ps1 script inside
I want to call a method say success(message) of javascript from android activity. I
I want to call function from another file in Go. Can any one help?
I want to call a method that returns a string value. Actually this string
I want to call a C# component from an unmanaged c++ service. I need
I want to call my update(id) javascript function from my flash menu with actionscript
Hi I want call f('append','more','arguments',a=1,b=2) but append is a method(function) of pyquery module so
I want to call a sproc on server B from server A in TSQL
I want call method path from class Path. I need set some number -

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.