rus*_*key 1 windows glassfish batch-file
尝试在批处理文件中设置Glassfish配置时,有一个命令在直接从命令行运行时有效 - 但在放入Windows批处理文件时失败.
命令:
call asadmin.bat create-auth-realm --classname com.sun.enterprise.security.auth.realm.ldap.LDAPRealm --property jaas-context="ldapRealm":directory="ldap\://domain.com\:389:base-dn=dc\=domain,dc\=com:group-base-dn=ou\=Groups,ou\=domain,dc\=com":search-bind-dn="CN\=username,OU\=Accounts,OU\=domain,DC\=com":search-bind-password="password":search-filter="(&(objectCategory\=user)(sAMAccountName\=%s))":group-search-filter="(&(objectCategory\=group)(member\=%d))" a-realm
Run Code Online (Sandbox Code Playgroud)
完全按照上面的命令行运行时,响应完成:
Command create-auth-realm executed successfully.
Run Code Online (Sandbox Code Playgroud)
完全按照上面的方式从批处理文件运行时,响应失败:
(member\ was unexpected at this time.
Run Code Online (Sandbox Code Playgroud)
请注意,某些等于字符的转义是针对Glassfish的,而不是尝试转义Windows批处理命令的字符.
我的猜测是,当在批处理文件中运行时,批处理文件将某些字符视为特殊字符.我试着逃避括号,没有运气.
该命令如何在批处理文件中工作!?
您的问题出在变量%s和%d中.
如果它们需要由批处理文件解释(它们是环境变量),则它们应为%s%和%d%.
如果它们不是环境变量,并且需要解释(不知道什么是玻璃鱼),那么它们应该是%% d和%% s