我想把变量名和值从jython脚本传递到批处理文件。另外,如何在批处理文件中访问它。你知道吗
在我的例子中,我想把变量名和值“bootstrapport”和“defaulthostport”传递给一个批处理文件部署.bat. 你知道吗
端口.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
========================================================================
解决了这个问题
将jython结果打印到文本文件中,然后将变量值从文本文件读取到批处理文件,然后删除文本文件。你知道吗
批处理文件
相关问题 更多 >
编程相关推荐