知道吗,您可以为所有的WLST会话创建一个配置文件。我的意思是,您可以创建一个配置文件脚本,只要调用WLST就执行它。我通常把我的为数不多的WLST扩展(一些不属于WLST的自定义命令)和一个连接行放在这个配置文件脚本中,这样我就不必执行每一个扩展,并针对每次WLST调用键入连接行了。
要拥有一个配置文件,只需创建一个名为wlstProfile.py的文件,并将其放在user.home目录下。还可以将wlstProfile.py放在调用WLST的当前目录中。下面就是一个wlstProfile.py的例子:
# wlstProfile that gets executed for every WLST invocation
print 'Setting up WLST JDBC extensions'
execfile('c:/wls/satya/scripts/jdbc/jdbcExtensions.py')
print 'Setting up WLST WLDF extensions'
execfile('c:/wls/satya/scripts/wldf/wldfExtensions.py')
print 'Now connecting... '
connect('weblogic','weblogic','t3://sghattu:7001')
如果不确定什么是user.home目录,可以执行以下代码:
wls:/(offline)> java.lang.System.getProperty("user.home")
'C:\\Documents and Settings\\SGhattu'
wls:/(offline)>
原文出处:http://dev2dev.bea.com/blog/sghattu/archive/2005/11/having_a_profil.html