I have a batch file (potchi.bat) that contains the lines
set maxHeap = 2048
set initialHeap = 512
set mydir=%cd%
and I want to pass these values to a jython script (myScript.py)
such that

fullpath = '%cd%/myApp.war'
AdminApp.installInteractive(fullpath, -contextroot myApp)
AdminTask.setJVMMaxHeapSize('[-serverName myServer -nodeName myNode -maximumHeapSize %maxHeap%]')
AdminTask.setJVMInitialHeapSize('[-serverName myServer -nodeName myNode -initialHeapSize %initialHeap%]')


In my batch file (test.bat) I have this code
set TEST=512
jython myScript.py

In myScript.py I have this code
import os

But running my test.bat, I get

'jython' is not recognized as an internal or external command,
operable program or batch file.

so that means I failed calling myScript.py

I'm stuck

Im using jython with wsadmin overhead
in WebSphere 6.1


Yes. I use wsadmin -lang jython -f myScript.py

but it gives me this error

WASX7209I: Connected to process "server1" on node myNode using SOAP connector; The type of process is: UnManagedProcess

Failed to get environment, environ will be empty: (0, "Failed to execute command (): java.io.IOException: CreateProcess: sh -c env error=2")
WASX7017E: Exception received while running file "myScript.py"; exception information: com.ibm.bsf.BSFException: exception from
Traceback (innermost last):
File "<string>", line 4, in ?
File "D:\IBM\WebSphere\AppServer\optionalLibraries\jython\Lib\javaos.py", line 137, in __getitem__
File "D:\IBM\WebSphere\AppServer\optionalLibraries\jython\Lib\UserDict.py", line 14, in __getitem__
KeyError: TEST

Code looks like trying to execute linux sh script for environment when you are showing us Windows path names.

So how can I do it?

Actually I have a properties file (myFile.properties) and my other option is
to put the parameters (maxHeap, initialHeap) in the properties file. The question is,
is there a way to read a properties file (myFile.properties) in jython?

As long as you have read permissions to the file and it is visible from Jython, why not. What is the format? Or you could use command line arguments like your title says.

Is it possible?

to pass command line variables to jython?

actually what happens to me is command line - server - jython

I am using jython of websphere 6.1

so Im calling my script this way

wsadmin -lang jython -f myScript.py

For regular jython everything works normally, you should check how websphere's environment is different.

import sys
K:\jython2.5.2>java -jar jython.jar args.py 123 24 435


the code above is not working,
is this because I am connecting to an application server (WebSphere 6.1)
before using jython?

In addition all my files should be located in ..\myAppRoot\bin