【发布时间】:2017-04-08 16:42:21
【问题描述】:
我想将变量名和值从 jython 脚本传递到批处理文件。另外,我如何在批处理文件中访问它。
在我的情况下,我想将“bootstrapport”和“defaulthostport”的变量名称和值传递给批处理文件 Deploy.bat。
ports.jy
-
servers = AdminConfig.list( 'ServerEntry' ).splitlines() for server
in servers : print '\n' print "Server Name : " +
server[0:server.find('(')] print "=" *30 NamedEndPoints =
AdminConfig.list( "NamedEndPoint" , server).splitlines()
for namedEndPoint in NamedEndPoints: endPointName =
AdminConfig.showAttribute(namedEndPoint, "endPointName" )
if endPointName == "BOOTSTRAP_ADDRESS":
bootstrapendPoint = AdminConfig.showAttribute(namedEndPoint, "endPoint" )
host = AdminConfig.showAttribute(bootstrapendPoint, "host" )
bootstrapport = AdminConfig.showAttribute(bootstrapendPoint, "port" )
print "Endpoint Name : " + endPointName + " Host : " + host + " port : " +
bootstrapport
elif endPointName == "WC_defaulthost":
defaulthostendPoint = AdminConfig.showAttribute(namedEndPoint,"endPoint" )
host = AdminConfig.showAttribute(defaulthostendPoint,"host" )
defaulthostport =AdminConfig.showAttribute(defaulthostendPoint, "port" )
print "Endpoint Name : " + endPointName + " Host : " + host + " port : " +
defaulthostport
========================================================================
【问题讨论】:
标签: python batch-file websphere jython