How to use multilines in cmd.Command?

I’m having troubles adding multiline command line scripts in the cmd.Command edit box. I know best practice is to add a script file that contains the actual script, and just call it as a oneliner from the cmd.Command, but… in this case the command has to run as one of the first items in a deployment, and if i change the order to e.g. 1, it will do that, but… the script itself is not there yet… and there is no way to change the order for copying files? At least not that i can see. The orchestrator might be the solution here, but that is practically useless, so complex, and, as is with many things in xldeploy, documentation is not there, not clear or just unworkable.

So, i need to add the script into the box or the xml… i found out that using shift-enter and eliminating all spaces works, but makes it unreadable and not maintainable. Also tried to use a CDATA element in the manifest.xml, but that also doesn’t work…

Is there a better way to add multiline commands (in my case, powershell) to the edit box or manifest.xml?

yes, the cmd is limited in that sense.
please have a look to the git repo: https://github.com/xebialabs-community/xld-advanced-command-plugin, this will allow multiline commands.

But remember; Using cmd and advanced cmd should be only used for verry rare cases, if you realy want to make use of the udm and model based approach of deploy, better think of an abstract model of your deployments and wrap it in a custom plugin, otherwise you turn deploy into a script orchestrator

1 Like

I don’t think it’s possible to have multiple lines in the command at all. But you should be able to copy the script file first. Just treat it like file.File not a script.Script, use the sequential-by-deployed orchestrator and name the script file as 1-my-file and the command as 2-my-command. I don’t have access to Deploy anymore but this should work.

1 Like

I did manage to add a multiline powershell script, by removing hard linebreaks (CR/LF). I was hoping a CDATA element in the xml would work but it did not.

The reason why i need this script is because of our project, it contains a Windows self installable service, that can not be handled by XLDeplot (XLD only handles ‘normal’ services). So i need a script to install the service at the end and to uninstall existing one on first install or update… The problem was that i could use the Order to make the script run first, but the file.file does not have order, so i had to use a multiline command…

But, the second part of you reply is new to me, i did not know you could influence the order by alphabet/numbers? Simply numbering the items? This will solve a lot of my issues… so if i number all my elements 01-step1, 02 step 2 etc, that will be the order they will be called? And in reverse when undeployed? Why didn’t i know this before? And why doesn’t xldeploy mention this anywhere when i search for ‘order’…

That’s what the sequential-by-deployed orchestrator does.

That makes sense. But i was under the impression that the sequence would be the order they occur in the GUI, not by alphabet :slight_smile: