I am trying to add a module to a WildFly instance using the JBoss PowerShell client, but it fails when the path to the module contains a space.
I have tried wrapping the path in single and double-quotes to no avail.
List of use cases tested:
\
)\
)""
)\
) in a double-quoted command.\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=C:/module directory/sqljdbc42.jar"
The command accepts 1 unnamed argument(s) but received: [add, directory/sqljdbc42.jar]
.\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources='C:/module directory/sqljdbc42.jar'"
The command accepts 1 unnamed argument(s) but received: [add, directory/sqljdbc42.jar']
.\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources="C:/module directory/sqljdbc42.jar""
'directory\sqljdbc42.jar' is assumed to be a command(s) but the commands to execute have been specified by another argument: [module add --name=mssql.jdbc --resources=C:\module]
\
).\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=C:/module\ directory/sqljdbc42.jar
Failed to locate C:\module\ directory\sqljdbc42.jar, if you defined a nonexistent resource on purpose you should use the --allow-nonexistent-resources option
.\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=C:/module` directory/sqljdbc42.jar"
The command accepts 1 unnamed argument(s) but received: [add, directory/sqljdbc42.jar]
.\jboss-cli.ps1 --connect --command='module add --name=mssql.jdbc --resources="C:/module directory/sqljdbc42.jar"'
'directory/sqljdbc42.jar' is assumed to be a command(s) but the commands to execute have been specified by another argument: [module add --name=mssql.jdbc --resources=C:/module]
.\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=`"C:/module directory/sqljdbc42.jar`""
'directory/sqljdbc42.jar' is assumed to be a command(s) but the commands to execute have been specified by another argument: [module add --name=mssql.jdbc --resources=C:/module]
\
).\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=\"C:/module directory/sqljdbc42.jar\""
'directory/sqljdbc42.jar\' is assumed to be a command(s) but the commands to execute have been specified by another argument: [module add --name=mssql.jdbc --resources=\C:/module]
""
).\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=""C:/module directory/sqljdbc42.jar"""
'directory/sqljdbc42.jar' is assumed to be a command(s) but the commands to execute have been specified by another argument: [module add --name=mssql.jdbc --resources=C:/module]
\
) in a double-quoted command.\jboss-cli.ps1 --connect --command="module add --name=mssql.jdbc --resources=\'C:/module directory/sqljdbc42.jar\'"
The command accepts 1 unnamed argument(s) but received: [add, 'C:/module, directory/sqljdbc42.jar\']
The correct format is to escape double-quotes inside a single-quoted command.
.\jboss-cli.ps1 --connect --command='module add --name=mssql.jdbc --resources=\"C:/module directory/sqljdbc42.jar\"'
Thank you @Aaron for your help.